我在使用remix框架时遇到了一个ESM模块错误:Error: Directory import '/app/build' is not supported resolving ES modules imported from /app/node_modules/@remix-run/serve/dist/cli.js Did you mean to import /app/build/index.js?
当我运行开发服务器或构建它时,它不会出现。但当我在Docker中运行它时,它确实有错误(我的Docker文件https://gist.github.com/BKG01/afd1b2745fab27763fd8b69d71ab06f0)
你知道我该怎么解决吗?
如果我直接运行node node_modules/.bin/remix-serve build
(在docker之外),我也会得到同样的错误。
1条答案
按热度按时间qcbq4gxm1#
将命令更改为
remix-serve ./build/index.js
解决了这个问题(ESM还不能导入模块。