簡體   English   中英

構建應用程序的問題 - Heroku / Nodejs

[英]Problem to build an app - 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);

結構:在此處輸入圖像描述

這是一種可行的解決方案。 如果有,請告訴我。 您似乎有一個節點應用程序,但在 Procfile 中您通常不會給出命令 npm start。 您給出起始 javascript 文件。

嘗試類似:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM