在 Heroku 中启动应用程序时出现"App crashed"错误



我需要帮助我的部署。一个SPA应用程序与Express &后端序列化;React - Redux在前端。目前,我正试图在Heroku部署后端,得到"应用程序错误";当我试图打开应用程序。

这是构建日志:

-----> Building on the Heroku-20 stack
-----> Using buildpacks:
1. https://github.com/timanovsky/subdir-heroku-buildpack
2. heroku/nodejs
-----> Subdir buildpack app detected
-----> Subdir buildpack in api/
creating cache: /tmp/codon/tmp/cache
created tmp dir: /tmp/codon/tmp/cache/subdir9yj6g
moving working dir: api/ to /tmp/codon/tmp/cache/subdir9yj6g
cleaning build dir /tmp/build_8e3b9b74
copying preserved work dir from cache /tmp/codon/tmp/cache/subdir9yj6g to build dir /tmp/build_8e3b9b74
cleaning tmp dir /tmp/codon/tmp/cache/subdir9yj6g
-----> Node.js app detected

-----> Creating runtime environment

NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true

-----> Installing binaries
engines.node (package.json):  >=12.18.3
engines.npm (package.json):   >=6.14.6

Resolving node version >=12.18.3...
Downloading and installing node 16.10.0...
Bootstrapping npm >=6.14.6 (replacing 7.24.0)...
npm >=6.14.6 installed

-----> Restoring cache
- node_modules

-----> Installing dependencies
Installing node modules (package.json)

up to date, audited 326 packages in 8s

36 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

-----> Build

-----> Caching build
- node_modules

-----> Pruning devDependencies

up to date, audited 130 packages in 2s

3 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

-----> Build succeeded!
-----> Discovering process types
Procfile declares types     -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 35.3M
-----> Launching...
Released v16
https://dogs-parade.herokuapp.com/ deployed to Heroku

这是我的package.json:

{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon -L",
"test": "mocha -w ./tests/**/*.spec.js",
"dev": "nodemon index.js"
},
"author": "Henry",
"license": "ISC",
"engines": {
"node": ">=12.18.3",
"npm": ">=6.14.6"
},
"dependencies": {
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"ioredis": "^4.19.2",
"jsonwebtoken": "^8.5.1",
"morgan": "^1.10.0",
"node-fetch": "^2.6.1",
"nodemon": "^2.0.13",
"pg": "^8.5.1",
"sequelize": "^6.3.5",
"uuid": "^8.3.2"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^8.2.1",  
"nodemon": "^2.0.13",  
"supertest": "^6.0.1",
"supertest-session": "^4.1.0"
}
}

更多的日志:

2021-09-25T17:12:58.108309+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-25T17:12:59.146899+00:00 app[web.1]: 
2021-09-25T17:12:59.146914+00:00 app[web.1]: > api@1.0.0 start
2021-09-25T17:12:59.146914+00:00 app[web.1]: > nodemon -L
2021-09-25T17:12:59.146914+00:00 app[web.1]: 
2021-09-25T17:12:59.151409+00:00 app[web.1]: sh: 1: nodemon: not found
2021-09-25T17:12:59.292193+00:00 heroku[web.1]: Process exited with status 127
2021-09-25T17:12:59.387500+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-25T17:13:04.948348+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dogs-parade.herokuapp.com request_id=09f97ba0-da58-40a6-a093-72aaf2dd7027 fwd="181.93.184.108" dyno= connect= service= status=503 bytes= protocol=https
2021-09-25T17:13:05.427952+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dogs-parade.herokuapp.com request_id=4b1e77d4-8ca4-4895-8ebe-7e049ecc6104 fwd="181.93.184.108" dyno= connect= service= status=503 bytes= protocol=https
2021-09-25T17:26:47.524721+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dogs-parade.herokuapp.com request_id=dc81cce2-c004-4270-bf5d-62c923f54788 fwd="77.182.35.121" dyno= connect= service= status=503 bytes= protocol=https
2021-09-25T17:26:48.044659+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dogs-parade.herokuapp.com request_id=b85ad081-27f7-41f7-a22b-ef2e9a34e58b fwd="77.182.35.121" dyno= connect= service= status=503 bytes= protocol=https
有谁能帮我一下吗?

我不太能够发现这个问题,但是也许重置Heroku中的所有dynos可能会解决这个问题,也许会再次检查环境变量和Procfile以防万一。希望这对你有所帮助!

相关内容