node.js - virtualbox virtual machine ununtu16.04 system uses npm to install bcrypt error
天蓬老师
天蓬老师 2017-05-24 11:38:57
0
1
1819

I am using ubuntu16.04 created by virtual box in win7 system, and I encountered the following error when using npm install bcrypt to install the bcrypt plug-in:


$ npm install bcrypt 

> bcrypt@1.0.2 install /home/jason/Q-A/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.10.3 (node-v48 ABI) (falling back to source compile with node-gyp) 
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack     at Object.exports._errnoException (util.js:1018:11)
gyp ERR! stack     at exports._exceptionWithHostPort (util.js:1041:20)
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
gyp ERR! System Linux 4.8.0-52-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/jason/Q-A/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/jason/Q-A/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/jason/Q-A/node_modules/bcrypt
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jason/Q-A/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/jason/Q-A/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/jason/Q-A/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:886:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.8.0-52-generic
node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/jason/Q-A/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jason/Q-A/node_modules/bcrypt
node-pre-gyp ERR! node -v v6.10.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jason/Q-A/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/jason/Q-A/node_modules/bcrypt/lib/binding' (1)
npm ERR! Linux 4.8.0-52-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@1.0.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, 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!     /home/jason/Q-A/npm-debug.log

I used the ubuntu system directly before, using the same method, and the above error did not occur. Please help me solve it. Thank you very much! !

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
Ty80

The main message of the error message is that the package you installed depends on a native module built with c++/c. This module needs to download the release file compiled for linux and build it through node-gyp. However, the pull failed due to network problems, so an error was reported.

One way is to check your network configuration, such as curl or wget to confirm that the network in the virtual machine terminal can pull this dependency.

Another way is to set up the domestic image source npm warehouse and reinstall it:

npm set registry https://registry.npm.taobao.org
npm install
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template