【发布时间】:2020-04-30 19:10:13
【问题描述】:
当我部署我的构建时,构建总是成功并运行。然而,在运行几秒钟后它崩溃了,没有关于原因的日志。我已经使用heroku local web 命令在本地进行了测试,它可以完美运行。我还使用 heroku bash 检查node_modules 以确保我的所有依赖项都已正确安装。我也尝试通过 heroku bash 运行,但发生了同样的错误。本地和远程的 Node 和 npm 版本相同,版本为 node: >=10.16.0 和 npm: >= 6.9.0。我还尝试将我的文件(不包括package-lock.json 和node_modules)复制到一个新目录中并使用npm install 和npm run start,并且仍然可以在本地正常工作。有任何想法吗?
更新
我回滚到之前使用 heroku 的回滚命令工作的提交,并且网站已启动并运行。我创建了一个临时分支并推送了我的更改,所以我现在正在解决这个问题。问题是我只是希望日志中有某种错误消息可以说明它崩溃的原因,因为这让我难过了好几天。
另一个更新
我安装了 ubuntu 来测试在 linux 操作系统上运行我的项目,看看这是否会重现这个问题,但它仍然可以正常运行。
** 最终更新 **
我设法让事情完全从头开始,一次添加一件事情。我知道这没有帮助,但我想保持这个问题开放,因为我仍然不知道是什么导致了这个问题。
package.json
{
"name": "hayewoodbotapi-v2",
"version": "0.0.0",
"scripts": {
"start": "npm run prod",
"build": "npm-run-all clean transpile",
"server": "node ./dist-server/bin/www",
"prod": "npm-run-all build server",
"transpile": "webpack && babel server --source-maps --out-dir dist-server",
"clean": "rimraf dist-server"
},
"dependencies": {
"@babel/node": "^7.2.2",
"babel-loader": "^8.1.0",
"cookie-parser": "~1.4.4",
"crypto-js": "^4.0.0",
"debug": "~2.6.9",
"ejs": "^3.0.1",
"express": "^4.17.1",
"express-generator": "^4.16.1",
"express-session": "^1.17.0",
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"lance-gg": "^4.0.8",
"morgan": "~1.9.1",
"nodemon": "^2.0.3",
"npm-run-all": "^4.1.5",
"passport": "^0.4.1",
"passport-oauth": "^1.0.0",
"passport-twitch": "^1.0.3",
"pg": "^7.18.2",
"query-string": "^6.12.0",
"regenerator-runtime": "^0.13.5",
"request": "^2.88.2",
"rimraf": "^3.0.2",
"sequelize": "^5.21.5",
"sequelize-cli": "^5.5.1",
"socket.io": "^2.3.0",
"webpack": "^3.8.1"
},
"engines": {
"node": ">=10.16.0",
"npm": ">=6.9.0"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"eslint": "^3.16.1",
"express-swagger-generator": "^1.1.17"
}
}
这是通过 heroku 获得的日志。如您所见,它正在执行,因为我添加了一个 console.log 语句来输出端口。
2020-04-30T18:50:49.307843+00:00 app[web.1]: Successfully compiled 23 files with Babel.
2020-04-30T18:50:50.111523+00:00 app[web.1]:
2020-04-30T18:50:50.111537+00:00 app[web.1]: > hayewoodbotapi-v2@0.0.0 server /app 2020-04-30T18:50:50.111537+00:00 app[web.1]: > node ./dist-server/bin/www
2020-04-30T18:50:50.111538+00:00 app[web.1]:
2020-04-30T18:50:52.021984+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-04-30T18:50:52.021997+00:00 app[web.1]: designed for a production environment, as it will leak
2020-04-30T18:50:52.021998+00:00 app[web.1]: memory, and will not scale past a single process. 2020-04-30T18:50:52.028026+00:00 app[web.1]: PORT: 49175 2020-04-30T18:50:52.063057+00:00 app[web.1]: (node:138) [SEQUELIZE0004]
DeprecationWarning: A boolean value was passed to options.operatorsAliases.
This is a no-op with v5 and should be removed.
2020-04-30T18:50:52.063059+00:00 app[web.1]: (Use node --trace-deprecation ... to show where the
warning was created) 2020-04-30T18:50:52.243126+00:00 heroku[web.1]: State changed from starting to crashed
【问题讨论】:
标签: heroku npm webpack babeljs