[英]Node.js app not deploying correctly on Heroku
My repository: https://github.com/jacklemasters/tech-blog我的存储库: https://github.com/jacklemasters/tech-blog
The app works locally on my machine, but I cannot seem to figure out why it will not work on Heroku. I have attempted completely moving the code, a new repository, nothing seems to help.该应用程序在我的机器上本地运行,但我似乎无法弄清楚为什么它不能在 Heroku 上运行。我尝试完全移动代码,一个新的存储库,似乎没有任何帮助。
Here are the error logs I am receiving from Heroku: 2021-10-04T14:32:52.833339+00:00 app[web.1]: npm ERR.这是我从 Heroku 收到的错误日志:2021-10-04T14:32:52.833339+00:00 app[web.1]: npm ERR。 tech-blog@1.0:0 start. tech-blog@1.0:0 开始。 node server:js 2021-10-04T14:32.52:833414+00.00 app[web:1]: npm ERR: Exit status 1 2021-10-04T14.32:52.833484+00:00 app[web:1]: npm ERR.节点服务器:js 2021-10-04T14:32.52:833414+00.00 app[web:1]: npm ERR: 退出状态 1 2021-10-04T14.32:52.833484+00:00 app[web:1]: npm ERR . 2021-10-04T14:32.52:833533+00.00 app[web.1]. 2021-10-04T14:32.52:833533+00.00 应用 [web.1]。 npm ERR: Failed at the tech-blog@1:0.0 start script: 2021-10-04T14.32:52.833601+00.00 app[web:1]: npm ERR. npm ERR:在 tech-blog@1:0.0 启动脚本失败:2021-10-04T14.32:52.833601+00.00 app[web:1]: npm ERR。 This is probably not a problem with npm: There is likely additional logging output above.这可能不是 npm 的问题:上面可能有其他日志记录 output。 2021-10-04T14:32:52:847732+00.00 app[web:1]. 2021-10-04T14:32:52:847732+00.00 应用 [web:1]。 2021-10-04T14:32:52:847831+00:00 app[web.1]: npm ERR. 2021-10-04T14:32:52:847831+00:00 app[web.1]: npm 错误。 A complete log of this run can be found in: 2021-10-04T14.32.52:847916+00:00 app[web.1]: npm ERR.可以在以下位置找到此运行的完整日志:2021-10-04T14.32.52:847916+00:00 app[web.1]: npm ERR。 /app/:npm/_logs/2021-10-04T14_32_52_834Z-debug:log 2021-10-04T14:32.53:006395+00.00 heroku[web:1]: Process exited with status 1 2021-10-04T14:32:53.089213+00:00 heroku[web.1]: State changed from starting to crashed /app/:npm/_logs/2021-10-04T14_32_52_834Z-debug:log 2021-10-04T14:32.53:006395+00.00 heroku[web:1]: 进程以状态 1 2021-10-04T14:32:53.089213+ 退出00:00 heroku[web.1]: State 从开始变为崩溃
edit: I understand it could be something with my packages, but on my side I see them as installed.编辑:我知道这可能与我的包裹有关,但在我这边,我看到它们已安装。 Still at a loss!还是亏了!
You are using libraries that you didn't import into the package.json with npm.您正在使用未导入 package.json 和 npm 的库。
Example: npm install express-session
示例: npm install express-session
Other thing that is wrong is to upload the.dotenv file to GitHub. Use the.gitignore to avoid it and configure the heroku envorinment variables.另一个错误是将 .dotenv 文件上传到 GitHub。使用 .gitignore 来避免它并配置 heroku envorinment 变量。 See more here: https://devcenter.heroku.com/articles/config-vars在此处查看更多信息: https://devcenter.heroku.com/articles/config-vars
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.