【发布时间】:2020-12-13 04:30:06
【问题描述】:
switching to use absolute paths 之后,虽然我的本地构建仍然可以正常工作,但 Github CI 构建失败并出现以下错误:
./src/App.js
Cannot find module: 'components/Layout'. Make sure this package is installed.
如何让 Firebase/Github CI 也搜索 src 目录?
【问题讨论】:
-
你能分享在CI和本地执行的构建命令吗?另外,假设是使用了 create-react-app,对吗?
-
是的,使用了 create-react-app。构建命令: npm install && CI=false npm run build。与本地相同:npm run build
-
你是否在根目录下创建了一个
.env文件,里面有NODE_PATH=src/? -
我确实尝试过,尽管它已被弃用以支持 jsconfig.json。构建中的消息:
Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.
标签: reactjs continuous-integration firebase-hosting github-ci