简体   繁体   中英

npm install bcrypt fails at node-gyp rebuild

i am trying to install the node module bcrypt

so i ran the following command

sudo npm install bcrypt

With this i get the following error:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-25-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/learningbankapi/src/node_modules/bcrypt
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/learningbankapi/src/npm-debug.log

I have attempted to remove all modules and sudo npm install ive also tried to rebuild but with no result can anyone help me out ?

Just install build-essential package :

sudo apt install build-essential

and install bcrypt :

npm i -S bcrypt

After searching Google for an hour I did the following 3 things and it began to work after the very last one. I know you're not on Windows, but maybe someone else who comes here will see this from a Windows machine like I did.

1.) I made sure Python was downloaded to C:\\Python2.7 and the path variable for Python was set.

2.) I did

npm install --global --production windows-build-tools`

It actually only got through the Python part of this piece, the next install (whatever it may be, I don't know because it took too long) was saying it was installing for an hour, so I just stopped it and moved onto step 3. and thankfully it worked.

3.) I added the below to my package.json as shown on another github thread. After doing this, and making sure the PYTHON variable was right it started to work. ```

"env": {
    "PYTHON": "C:/python2.7"
  },
  "subdomain": "bcrypt-test",
  "engines": {
    "node": "0.6.x"
  },
  "repository": {},
  "domains": [],
  "databases": {}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM