suchen

Heim  >  Fragen und Antworten  >  Hauptteil

node.js – Virtualbox-Virtual-Machine-Ununtu16.04-System verwendet npm, um einen bcrypt-Fehler zu installieren

Ich verwende Ubuntu 16.04, das von Virtual Box im Win7-System erstellt wurde, und habe bei der Verwendung des npm install bcrypt安装bcryptPlug-Ins den folgenden Fehler festgestellt:


$ 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

Das Ubuntu-System, das ich direkt zuvor verwendet habe, hat die gleiche Methode verwendet und der oben genannte Fehler ist nicht aufgetreten. Vielen Dank! !

天蓬老师天蓬老师2770 Tage vor1877

Antworte allen(1)Ich werde antworten

  • PHP中文网

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

    报错内容大意是,你安装的包依赖了一个 c++ / c 构建的原生模块,这个模块需要下载为 linux 编译后的 release 文件,并通过 node-gyp 来构建。但由于网络问题拉取失败,所以报错。

    一种方式是检查你的网络配置,例如 curl 或 wget 确认虚拟机终端内网络能够拉取这个依赖。

    另一种方式是设置国内的镜像源 npm 仓库后重新安装:

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

    Antwort
    0
  • StornierenAntwort