Nitin Kumar
Nitin Kumar

Reputation: 21

Nodejs not deploying on heroku - node-pre-gyp install --fallback-to-build

first of all i want to establish, this is my first time experience with heroku. I have tried "git push heroku master" several times with lot of different ways. It always shows the error I mentioned in the subject. None of heroku's troubleshooting helped me.

following is the output after "git push heroku master"

Enumerating objects: 3914, done.
Counting objects: 100% (3914/3914), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3695/3695), done.
Writing objects: 100% (3914/3914), 3.12 MiB | 492.00 KiB/s, done.
Total 3914 (delta 816), 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.16.3
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.16.3...
remote: Downloading and installing node 10.16.3...
remote: Using default npm version: 6.9.0
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote:
remote: > [email protected] install /tmp/build_fada90eccb7c7d6ba0075c19092f07ad/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! [email protected] install: node-pre-gyp install --fallback-to-build
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] 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.9MtEy/_logs/2019-09-14T11_53_20_827Z-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://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
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 face-recognition-api-with-js.
remote:
To https://git.heroku.com/face-recognition-api-with-js.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/face-recognition-api-with-js.git'

Upvotes: 0

Views: 1925

Answers (1)

KaroDev
KaroDev

Reputation: 63

I had exactly the same problem and the solution below helped me. You probably included the node modules in your git repository, and it's better if they are out of git. To remove them from git, try doing:

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

Then:

git add .gitignore
git commit -m "ready to deploy"
git push heroku master

For more information you can go to: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits

Upvotes: 2

Related Questions