【发布时间】:2021-11-30 20:32:53
【问题描述】:
我试图在 heroku 上部署我的 discord.js 机器人,但我总是收到错误并且机器人崩溃。我的代码很好,我在我的电脑上运行它,它没有给出任何错误。我按照此链接设置了我的 heroku 应用程序https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up。我完全按照它说的做了,但我收到了这个错误:
2021-10-12T08:15:45.604131+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:46.708903+00:00 app[web.1]:
2021-10-12T08:15:46.709032+00:00 app[web.1]: > kurumi@1.0.0 start /app
2021-10-12T08:15:46.709036+00:00 app[web.1]: > node index.js
2021-10-12T08:15:46.709036+00:00 app[web.1]:
2021-10-12T08:15:46.772460+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:46.772464+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:46.772465+00:00 app[web.1]: ^^^
2021-10-12T08:15:46.772465+00:00 app[web.1]:
2021-10-12T08:15:46.772468+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:46.772468+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:46.772468+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.779715+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:46.779895+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:46.783479+00:00 app[web.1]: npm ERR! kurumi@1.0.0 start: `node index.js`
2021-10-12T08:15:46.783529+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:46.783595+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:46.783640+00:00 app[web.1]: npm ERR! Failed at the kurumi@1.0.0 start script.
2021-10-12T08:15:46.783698+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:46.786955+00:00 app[web.1]:
2021-10-12T08:15:46.787031+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:46.787064+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_46_784Z-debug.log
2021-10-12T08:15:46.938086+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:47.109411+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:15:47.120433+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-12T08:15:50.000000+00:00 app[api]: Build succeeded
2021-10-12T08:15:51.902833+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:52.879739+00:00 app[web.1]:
2021-10-12T08:15:52.879754+00:00 app[web.1]: > kurumi@1.0.0 start /app
2021-10-12T08:15:52.879755+00:00 app[web.1]: > node index.js
2021-10-12T08:15:52.879755+00:00 app[web.1]:
2021-10-12T08:15:52.943619+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:52.943621+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:52.943621+00:00 app[web.1]: ^^^
2021-10-12T08:15:52.943622+00:00 app[web.1]:
2021-10-12T08:15:52.943622+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:52.943623+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:52.943623+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.950345+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:52.950523+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:52.953970+00:00 app[web.1]: npm ERR! kurumi@1.0.0 start: `node index.js`
2021-10-12T08:15:52.954012+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:52.954061+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:52.954092+00:00 app[web.1]: npm ERR! Failed at the kurumi@1.0.0 start script.
2021-10-12T08:15:52.954134+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:52.956414+00:00 app[web.1]:
2021-10-12T08:15:52.956490+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:52.956517+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_52_954Z-debug.log
2021-10-12T08:15:53.132196+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:53.198551+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:16:14.979868+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-thicket-97709.herokuapp.com request_id=bc0fd458-0a88-4f7f-8fe6-7a21d52e3035 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
2021-10-12T08:16:15.988690+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-thicket-97709.herokuapp.com request_id=b830f6e2-5525-4310-b415-4e902015b8e3 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
【问题讨论】:
标签: node.js heroku npm discord.js