【问题标题】:HEROKU : node-pre-gyp install --fallback-to-buildHEROKU : node-pre-gyp install --fallback-to-build
【发布时间】:2021-01-13 21:20:42
【问题描述】:

自从我使用@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`

【问题讨论】:

  • 编辑:构建在我的电脑上运行良好,并且播放了声音。
  • 最后,我忽略了 Heroku 的 node-modules 文件夹和 package-lock.json。
  • 尝试在您的 package.json 中设置 npm 和节点版本,以便 Heroku 使用您计算机上的内容。顺便说一句,您需要将 package-lock.json 部署到 Heroku。

标签: node.js heroku discord.js


【解决方案1】:

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

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

【讨论】:

  • 很高兴它成功了。尝试仅在您的 package.json 上将您的节点版本降级为 10.13.0,这似乎可以解决某些人的问题。
猜你喜欢
  • 2020-02-05
  • 2020-01-17
  • 2018-08-05
  • 1970-01-01
  • 2018-12-08
  • 2019-12-22
  • 2016-02-01
  • 2016-02-12
  • 2021-11-26
相关资源
最近更新 更多