【问题标题】:Heroku building failedHeroku 构建失败
【发布时间】:2021-01-20 23:29:12
【问题描述】:

我尝试在 Heroku 上部署我的 discord 机器人,但我得到的只是构建日志上的很多错误,我对此一无所知。

我的机器人工作正常,没有任何问题,我对此非常确定,我可以 100% 托管我的机器人,没有任何问题,但我不知道问题出在哪里

这是我的build log

-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 12.x...
       Downloading and installing node 12.18.4...
       Using default npm version: 6.14.6
       
-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       
       > @discordjs/opus@0.3.2 install /tmp/build_4f5f37cb_/node_modules/@discordjs/opus
       > node-pre-gyp install --fallback-to-build
       
       sh: 1: node-pre-gyp: Permission denied
       npm ERR! code ELIFECYCLE
       npm ERR! errno 126
       npm ERR! @discordjs/opus@0.3.2 install: `node-pre-gyp install --fallback-to-build`
       npm ERR! Exit status 126
       npm ERR! 
       npm ERR! Failed at the @discordjs/opus@0.3.2 install script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.KeDLW/_logs/2020-10-06T05_12_33_544Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - node_modules checked into source control
         https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

【问题讨论】:

标签: javascript node.js heroku discord.js


【解决方案1】:

如果您仍然需要帮助,或者我之后的任何其他人,安装 MS 构建工具为我解决了这个问题。

npm install --global --production windows-build-tools --vs2017 

记得使用具有管理员权限的 PowerShell 运行它(搜索 PowerShell,右键单击它并选择“以管理员身份运行”)

更新:也这样做: https://github.com/nodejs/node-gyp/issues/1747#issuecomment-491692750,但将最后一个设置为 npm config set msvs_version 2017 而不是 npm config set msvs_version 2015

然后运行 npm install node-pre-gypnpm install @discordjs/opus

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-23
    • 1970-01-01
    • 2020-10-09
    • 2015-11-23
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 2021-07-14
    相关资源
    最近更新 更多