首页 > 解决方案 > HEROKU : node-pre-gyp install --fallback-to-build

问题描述

自从我使用@discordjs/opus 以来,我就遇到了这个问题,我到处都看到了一大堆类似的问题,但没有什么能帮助我改变这个错误。它总是关注节点预gyp。我首先尝试将它手动放入我的 package.json 中,并且构建成功,但是没有声音播放,并且构建日志中有很多警告消息......还有一些人对 bcrypt 有问题,但它不是这里的情况...

谢谢你的帮助!

       
-----> 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
       
-----> Restoring cache
       - node_modules is checked into source control and cannot be cached
       
-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       
       > @discordjs/opus@0.3.2 install /tmp/build_2510a47a_/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.N30Iz/_logs/2020-09-28T09_36_00_646Z-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`

标签: node.jsherokudiscord.js

解决方案


好吧,正如 JM-AGMS 所说,解决方案是设置可见的包锁定,在包中键入节点引擎,然后删除节点模块文件夹以成功构建。

但是,关于节点 pre-gyp 的错误仍然存​​在。


推荐阅读