程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了构建应用程序的问题 - Heroku / Nodejs大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决构建应用程序的问题 - Heroku / Nodejs?

开发过程中遇到构建应用程序的问题 - Heroku / Nodejs的问题如何解决?下面主要结合日常开发的经验,给出你关于构建应用程序的问题 - Heroku / Nodejs的解决方法建议,希望对你解决构建应用程序的问题 - Heroku / Nodejs有所启发或帮助;

我不知道是什么问题,我已经搜索了很多,但我没有找到解决方案/ ps:它在本地工作

日志:

2021-04-27T17:19:31.439308+00:00 app[web.1]: npm ERR! 
2021-04-27T17:19:31.439845+00:00 app[web.1]: npm ERR! Failed at the BACkend@1.0.0 start script.
2021-04-27T17:19:31.440436+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-04-27T17:19:31.484421+00:00 app[web.1]: 
2021-04-27T17:19:31.486598+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-04-27T17:19:31.486969+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-04-27T17_19_31_448Z-deBUG.log
2021-04-27T17:19:31.571932+00:00 heroku[web.1]: Process exited with status 1
2021-04-27T17:19:31.655370+00:00 heroku[web.1]: State changed from starTing to crashed
2021-04-27T17:19:33.743010+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strateegia-trello-BACkend.herokuapp.com request_ID=9329fa95-97d4-425b-879d-17378a687872 fwd="45.187.85.169" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T17:19:34.055438+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strateegia-trello-BACkend.herokuapp.com request_ID=8c16c47c-645e-4db8-8b90-53f221d79d14 fwd="45.187.85.169" dyno= connect= service= status=503 bytes= protocol=https

Package.Json:

{
  "name": "BACkend","version": "1.0.0","ENGInes": {
    "node": "14.16.1"
  },"description": "","main": "index.Js","scripts": {
    "test": "echo \"Error: no test specifIEd\" && exit 1","start": "nodemon src/server.Json"
  },"keywords": [],"author": "","license": "ISC","dependencIEs": {
    "cors": "^2.8.5","crypto-Js": "^4.0.0","express": "^4.17.1","mongoose": "^5.12.3","node-fetch": "^2.6.1"
  },"devDependencIEs": {
    "nodemon": "^2.0.7"
  }
}

简介:

web: npm start

在server.Js的最后,我有:

app.Listen(process.env.PORT || 3333);

结构: enter image description here

解决方法

这是一种可行的解决方案。如果有,请告诉我。 您似乎有一个节点应用程序,但在 Procfile 中您通常不会给出命令 npm start。您提供起始 javascript 文件。

尝试类似:

Procfile: web app.js 
// whatever is the name of your main javascript file name.

大佬总结

以上是大佬教程为你收集整理的构建应用程序的问题 - Heroku / Nodejs全部内容,希望文章能够帮你解决构建应用程序的问题 - Heroku / Nodejs所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。