【发布时间】:2021-04-27 17:29:02
【问题描述】:
我不知道是什么问题,我已经搜索了很多但我没有找到解决方案 / 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
包.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);
【问题讨论】:
-
"start": "nodemon src/server.json" 我认为它需要是 server.js 而不是 server.json
标签: javascript node.js heroku build