我在heroku中的应用程序有问题。有人可以帮我这个日志吗?
2018-07-26T08:40:49.427912 + 00:00 app [web.1]:npm ERR! myreads@1.0.1开始:
preStart
2018-07-26T08:40:49.428082 + 00:00 app [web.1]:npm ERR!产生ENOENT
2018-07-26T08:40:49.428347 + 00:00 app [web.1]:npm ERR!
2018-07-26T08:40:49.428831 + 00:00 app [web.1]:npm ERR!在myreads@1.0.1启动脚本处失败。
2018-07-26T08:40:49.429027 + 00:00 app [web.1]:npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。
2018-07-26T08:40:49.436775 + 00:00 app [web.1]:
2018-07-26T08:40:49.437011 + 00:00 app [web.1]:npm ERR!可以在以下位置找到此运行的完整日志:
2018-07-26T08:40:49.437188 + 00:00 app [web.1]:npm ERR! /app/.npm/_logs/2018-07-26T08_40_49_430Z-debug.log
2018-07-26T11:56:02.600061 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”,方法= GET path =“ /” host = my-books-reads.herokuapp .com request_id = 6ebca156-9e51-4be5-817e-8d85c3d49dcd fwd =“ 177.107.242.1” dyno = connect = service = status = 503字节= protocol = https
2018-07-26T11:56:03.098985 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”,方法= GET path =“ / favicon.ico” host = my-books- reads.herokuapp.com request_id = b8af4900-60a2-4edf-a4db-2113e9cddaec fwd =“ 177.107.242.1” dyno = connect = service = status = 503 bytes = protocol = https
答案 0 :(得分:0)
可以检查是否对端口号进行了硬编码吗? 如果是这样,请尝试以下代码
app.listen(process.env.PORT || 3000);
或在命令下运行
heroku restart
答案 1 :(得分:0)
默认情况下,react-scripts是CRA应用程序的devDependency,但是Heroku Node buildpack的环境为NODE_ENV = production,这会导致npm安装跳过devDependencies。
也要安装那些devDependencies:
将此脚本添加到您的package.json中:
"heroku-postbuild": "npm install --only=dev"
试用一下,我认为应该可以解决问题