【问题标题】:I need to push my app to heroku via git, but i get error "Push failed我需要通过 git 将我的应用程序推送到 heroku,但出现错误“推送失败
【发布时间】:2021-01-11 17:36:27
【问题描述】:

我使用 node.js 创建了我的应用程序,我需要将其推送到我在 heroku 中的存储库,但是收到推送失败的错误,我已包含从我的控制台显示的错误信息。请任何可以帮助我的人

$ git push heroku master
Enumerating objects: 3928, done.
Counting objects: 100% (3928/3928), done.
Delta compression using up to 4 threads  
Compressing objects: 100% (3774/3774), done.
Writing objects: 100% (3928/3928), 4.54 MiB | 153.00 KiB/s, done.
Total 3928 (delta 735), reused 0 (delta 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):  10.15.3
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 10.15.3...
remote:        Downloading and installing node 10.15.3...
remote:        Using default npm version: 6.4.1
remote:        
remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:        
remote:        > bcrypt@3.0.6 install /tmp/build_c2d2c217441a5d9a6c6d5e4798bcaba5/node_modules/bcrypt
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! bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
remote:        npm ERR! Exit status 126
remote:        npm ERR!
remote:        npm ERR! Failed at the bcrypt@3.0.6 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.zomUn/_logs/2019-11-03T17_00_27_739Z-debug.log
remote:
remote: -----> Build failed
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...

【问题讨论】:

  • 你从远端看到了吗? "sh: 1: node-pre-gyp: Permission denied"
  • 也许看看完整的日志。
  • @daniel 我该如何解决这个错误
  • @Luca 完整的日志是我发布的,我已经堆在那里,我需要可以帮助我的人

标签: node.js git heroku


【解决方案1】:

错误是由于 node_modules 造成的,所以我所做的就是将此代码运行到我的项目终端

$echo "node_modules" >> .gitignore
$git rm -r --cached node_modules
$git commit -am 'untracked node_modules'

我设法将我的应用部署到 heroku

【讨论】:

    【解决方案2】:
    git rm -r --cached node_modules
    git commit -m'Remove node_modules'
    

    【讨论】:

    • 请不要只发布代码作为答案,还要解释您的代码的作用以及它如何解决问题的问题。带有解释的答案通常更有帮助,质量更高,更有可能吸引投票。
    猜你喜欢
    • 2012-06-12
    • 2016-11-17
    • 1970-01-01
    • 2016-09-17
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2021-11-22
    • 2014-03-23
    相关资源
    最近更新 更多