【发布时间】:2022-01-03 09:59:39
【问题描述】:
我正在用 NodeJs 制作一个不和谐的音乐机器人,我一直在尝试在 Heroku 上托管它,但它总是因为这个问题而崩溃
/app/node_modules/discord.js/src/rest/APIRequest.js:34
agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
^^^
SyntaxError: Unexpected token '??='
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:5:20)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bee25@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bee25@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-03T09:38:33.704796+00:00 app[Worker.1]:
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2022-01-03T09_38_33_700Z-debug.log
State changed from up to crashed
at=error code=H14 desc="No web processes running" method=GET path="/" host=bot-bee25.herokuapp.com request_id=e40f06e4-6d14-4cd4-ba4e-baa2091a87c9 fwd="216.245.221.84" dyno= connect= service= status=503 bytes= protocol=https
我该如何解决这个问题??
【问题讨论】:
-
在 Heroku 上使用更新的 Node 版本?阅读例如devcenter.heroku.com/articles/….
-
我使用的是 Node 16。不幸的是
标签: node.js heroku deployment build discord.js