Maison  >  Questions et réponses  >  le corps du texte

node.js - Le système ununtu16.04 de la machine virtuelle Virtualbox utilise NPM pour installer l'erreur bcrypt

J'utilise Ubuntu16.04 créé par Virtual Box dans le système Win7. J'ai rencontré l'erreur suivante lors de l'utilisation du npm install bcrypt安装bcryptplug-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

Le système Ubuntu que j'ai utilisé directement auparavant a utilisé la même méthode et l'erreur ci-dessus ne s'est pas produite. Veuillez m'aider à la résoudre. Merci beaucoup ! !

天蓬老师天蓬老师2706 Il y a quelques jours1779

répondre à tous(1)je répondrai

  • PHP中文网

    PHP中文网2017-05-24 11:40:57

    Le message principal du message d'erreur est que le package que vous avez installé dépend d'un module natif construit avec c++/c. Ce module doit télécharger le fichier de version compilé pour Linux et le construire via node-gyp. Cependant, l'extraction a échoué en raison de problèmes de réseau, une erreur a donc été signalée.

    Une solution consiste à vérifier la configuration de votre réseau, telle que curl ou wget, pour confirmer que le réseau du terminal de la machine virtuelle peut extraire cette dépendance.

    Une autre façon consiste à configurer l'entrepôt npm source miroir domestique et à le réinstaller :

    npm set registry https://registry.npm.taobao.org
    npm install

    répondre
    0
  • Annulerrépondre