node.js - 将 React 应用程序部署到 Heroku 时出现问题 - 即使 package.json 在那里也找不到
问题描述
尝试将 React/Express 全栈应用程序部署到 Heroku - 我已经(希望)将所有必要的脚本放在适当的位置以运行生产构建等,但我正在将 git 存储库推送到 Heroku收到以下错误消息:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_b6f0fb08/exercise-logger/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_b6f0fb08/exercise-logger/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.KjmHh/_logs/2021-05-26T14_40_48_002Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! exercise-logger@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix exercise-logger && npm run build --prefix exercise-logger`
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the exercise-logger@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.KjmHh/_logs/2021-05-26T14_40_48_038Z-debug.log
package.json 文件肯定在根目录(exercise-logger)中,所以我真的不明白为什么我会收到这条消息!
我以前从未部署到 Heroku 或除 Github Pages 以外的任何地方,所以我对此很陌生,因此不知道从哪里开始故障排除......任何朝着正确方向的指针将不胜感激!
解决方案
推荐阅读
- mdx - Mondrian MDX query: total aggregations
- doxygen - 如何更改 doxygen API 网页中显示的包含文件路径?
- git - 无限 git pull git 远程修剪循环 - 如何修复?
- node.js - Node.js 和 MongoDB 没有正确读取变量
- django - 涉及不查询几何本身的具有几何的表的查询是否比没有几何的表需要更长的查询时间?
- html - FullCalendar 标题显示 MM/YYYY 堆叠而不是并排显示
- python - RaspberryPi:TypeError:不支持的格式字符串传递给 NoneType.__format__ dht22 lcd 16x2
- oracle - Sql*Plus 错误:ORA-12154 将 sql*plus 与 oracle 12.2.0.1 Docker 映像连接
- node.js - Mongoose .findByIdAndDelete 返回 null
- java - 代码创建了比需要更多的 swing Timer 实例