Node.js Heroku 进程崩溃
Node.js Heroku process crashes
我正在尝试使用 heroku.com 托管来托管 discord 机器人
所以我尝试开始部署并且没有出现错误,
但如果我进入控制台,我会看到:
2021-09-06T14: 22: 20.024343 + 00: 00 heroku [web.1]: Process exited
with status 1 2021-09-06T14: 22: 20.283616 + 00: 00 heroku [web.1]:
State changed from starting to crashed 2021-09-06T14: 22: 20.288059 +
00: 00 heroku [web.1]: State changed from crashed to starting
2021-09-06T14: 22: 24.651531 + 00: 00 heroku [web.1]: Starting process
with command npm start
2021-09-06T14: 22: 27.056803 + 00: 00 app
[web.1]: npm ERR! missing script: start 2021-09-06T14: 22: 27.063092 +
00: 00 app [web.1]: 2021-09-06T14: 22: 27.063269 + 00: 00 app [web.1]:
npm ERR! A complete log of this run can be found in: 2021-09-06T14:
22: 27.063325 + 00: 00 app [web.1]: npm ERR!
/app/.npm/_logs/2021-09-06T14_22_27_057Z-debug.log 2021-09-06T14: 22:
27.112489 + 00: 00 heroku [web.1]: Process exited with status 1 2021-09-06T14: 22: 27.182105 + 00: 00 heroku [web.1]: State changed
from starting to crashed
所以,进程崩溃了,实际上,如果我尝试转到此处-> https://bouncerbotds.herokuapp.com,我会收到错误消息。老实说,我不明白为什么当我去:node .
同一个项目时,我的机器上一切正常。
有人知道我怎么解决吗?
错误超级清楚!您在 package.json
中缺少一个 start
脚本,您可能已经在 Heroku Procfile
中将部署命令初始化为 npm start
尽管它是 运行 一些东西它需要一个我们称之为 start
的默认脚本,您可以这样添加它:
"scripts": {
"start": "node index.js"
}
你可以看看npm documentation,以便更好地理解它!
我正在尝试使用 heroku.com 托管来托管 discord 机器人 所以我尝试开始部署并且没有出现错误,
但如果我进入控制台,我会看到:
2021-09-06T14: 22: 20.024343 + 00: 00 heroku [web.1]: Process exited with status 1 2021-09-06T14: 22: 20.283616 + 00: 00 heroku [web.1]: State changed from starting to crashed 2021-09-06T14: 22: 20.288059 + 00: 00 heroku [web.1]: State changed from crashed to starting 2021-09-06T14: 22: 24.651531 + 00: 00 heroku [web.1]: Starting process with command
npm start
2021-09-06T14: 22: 27.056803 + 00: 00 app [web.1]: npm ERR! missing script: start 2021-09-06T14: 22: 27.063092 + 00: 00 app [web.1]: 2021-09-06T14: 22: 27.063269 + 00: 00 app [web.1]: npm ERR! A complete log of this run can be found in: 2021-09-06T14: 22: 27.063325 + 00: 00 app [web.1]: npm ERR! /app/.npm/_logs/2021-09-06T14_22_27_057Z-debug.log 2021-09-06T14: 22: 27.112489 + 00: 00 heroku [web.1]: Process exited with status 1 2021-09-06T14: 22: 27.182105 + 00: 00 heroku [web.1]: State changed from starting to crashed
所以,进程崩溃了,实际上,如果我尝试转到此处-> https://bouncerbotds.herokuapp.com,我会收到错误消息。老实说,我不明白为什么当我去:node .
同一个项目时,我的机器上一切正常。
有人知道我怎么解决吗?
错误超级清楚!您在 package.json
中缺少一个 start
脚本,您可能已经在 Heroku Procfile
中将部署命令初始化为 npm start
尽管它是 运行 一些东西它需要一个我们称之为 start
的默认脚本,您可以这样添加它:
"scripts": {
"start": "node index.js"
}
你可以看看npm documentation,以便更好地理解它!