typescript 错误:不支持目录导入“/app/build”解析ES模块

qncylg1j  于 7个月前  发布在  TypeScript
关注(0)|答案(1)|浏览(109)

我在使用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之外),我也会得到同样的错误。

qcbq4gxm

qcbq4gxm1#

将命令更改为remix-serve ./build/index.js解决了这个问题(ESM还不能导入模块。

相关问题