My application runs well locally but when I use the command 'git push heroku', it got an application error. The I use the command 'heroku logs --tail' and it shows the error info as below. I hope someone can help me with this issue, many thanks.
// From my terminal:
2022-07-27T15:44:24.983651 00:00 app[web.1]: > nodemon --watch
backend --exec babel-node backend/server.js
2022-07-27T15:44:24.983654 00:00 app[web.1]:
2022-07-27T15:44:25.031291 00:00 app[web.1]: sh: 1: nodemon:
not found
2022-07-27T15:44:25.310188 00:00 heroku[web.1]: Process exited
with status 127
2022-07-27T15:44:25.401566 00:00 heroku[web.1]: State changed
from starting to crashed
2022-07-27T15:44:47.638568 00:00 heroku[router]: at=error
code=H10 desc="App crashed" method=GET path="/" host=my-amason-
app.herokuapp.com request_id=c61d813e-1467-4474-8b4d-
ad2ecc4141ad fwd="162.212.108.4" dyno= connect= service=
status=503 bytes= protocol=https
2022-07-27T15:44:47.962345 00:00 heroku[router]: at=error
code=H10 desc="App crashed" method=GET path="/favicon.ico"
host=my-amason-app.herokuapp.com request_id=243e98ef-4b26-4a93-
89f5-38515d30a4a4 fwd="162.212.108.4" dyno= connect= service=
status=503 bytes= protocol=https
2022-07-27T16:09:50.250878 00:00 heroku[router]: at=error
code=H10 desc="App crashed" method=GET path="/" host=my-amason-
app.herokuapp.com request_id=56e35e15-10e9-4609-8af0-
9d42d97bdde7 fwd="162.212.108.4" dyno= connect= service=
status=503 bytes= protocol=https
2022-07-27T16:09:50.746665 00:00 heroku[router]: at=error
code=H10 desc="App crashed" method=GET path="/favicon.ico"
host=my-amason-app.herokuapp.com request_id=dfe6b501-c155-4e8a-
8e8d-ad115771fd08 fwd="162.212.108.4" dyno= connect= service=
status=503 bytes= protocol=https
//package.json:
{
"dependencies": {
"@babel/cli": "^7.18.6",
"@babel/core": "^7.18.6",
"@babel/node": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-async-handler": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.13.14",
"multer": "^1.4.5-lts.1",
"react-paypal-button-v2": "^2.6.3",
"ts-node": "^10.9.1"
},
"name": "amason",
"version": "1.0.0",
"type": "module",
"main": "index.js",
"devDependencies": {
"nodemon": "^2.0.18"
},
"engines": {
"node": "16.13.2",
"npm": "8.1.2"
},
"scripts": {
"build": "cd frontend && npm install && npm run build",
"start": "nodemon --watch backend --exec babel-node
backend/server.js"
},
"author": "",
"license": "ISC",
"description": ""
}
// Procfile:
web:node --experimental-modules backend/server.js
CodePudding user response:
For development use nodemon. Example => "start":"nodemon index.js"
For production use node. Example => "start":"node index.js".