我的 Heroku 构建一直失败,我不知道为啥

Posted

技术标签:

【中文标题】我的 Heroku 构建一直失败,我不知道为啥【英文标题】:My Heroku build keeps failing and I have no idea why我的 Heroku 构建一直失败,我不知道为什么 【发布时间】:2020-11-23 23:34:09 【问题描述】:

我一直在尝试在 Heroku 上部署我的机器人的最后一步,但总是失败。我不知道为什么它一直在发生,因为到目前为止一切都很好。我对所有这些东西都很陌生,我只是不明白为什么它不想工作。我试着四处搜索,但没有帮助。

Enumerating objects: 2500, done.
Counting objects: 100% (2500/2500), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2395/2395), done.
Writing objects: 100% (2500/2500), 54.90 MiB | 3.67 MiB/s, done.
Total 2500 (delta 570), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.18.3
remote:        Using default npm version: 6.14.6
remote:        
remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:        
remote:        > @discordjs/opus@0.3.2 install /tmp/build_9bd73166/node_modules/@discordjs/opus
remote:        > node-pre-gyp install --fallback-to-build
remote:        
remote:        sh: 1: node-pre-gyp: Permission denied
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 126
remote:        npm ERR! @discordjs/opus@0.3.2 install: `node-pre-gyp install --fallback-to-build`
remote:        npm ERR! Exit status 126
remote:        npm ERR! 
remote:        npm ERR! Failed at the @discordjs/opus@0.3.2 install script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.C5Y7h/_logs/2020-08-03T21_26_46_714Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        Some possible problems:
remote:        
remote:        - node_modules checked into source control
remote:          https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
remote:        
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to essential-bot.
remote: 

【问题讨论】:

您是否按照其建议查看了日志? 是的,我不知道是什么原因造成的 那么日志是怎么说的? 我不确定,但也许你没有登录到 Heroku 的 CLI?我们可以看到日志吗? 【参考方案1】:

删除node_modules 文件夹,然后重试。

【讨论】:

以上是关于我的 Heroku 构建一直失败,我不知道为啥的主要内容,如果未能解决你的问题,请参考以下文章

在对 Apache2 进行安全更新后,我的 CORS 请求开始失败。我不知道为啥。

为啥我不应该将 virtualenv 推送到 Heroku?

我正在尝试登录并检查用户是不是存在,但我的执行标量一直返回 null,我不知道为啥?

为啥 Heroku 每次都要安装这么多模块?

我的 WindowsForm 只是忽略了一些代码行,我不知道为啥?

Discord.js 机器人的 Heroku 构建失败