centos7 安装bcrypt问题。
发布于 8 年前 作者 luoshizheng 5185 次浏览 来自 问答

先现在在CENT7上面安装的最新的node版本,我把原来的代码从服务器上下载下来后,在安装模块的时候出现错误。大家帮忙看看

Error: /usr/local/project/Ep/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header at Error (native) at Object.Module._extensions…node (module.js:450:18) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) at bindings (/usr/local/project/Ep/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44) at Object.<anonymous> (/usr/local/project/Ep/node_modules/bcrypt/bcrypt.js:3:35) at Module._compile (module.js:425:26) at Object.Module._extensions…js (module.js:432:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (/usr/local/project/Ep/MyModules/TableStructs.js:6:14) at Module._compile (module.js:425:26)

** 这一个错误是因为我把原来的bcrypt包直接拷贝在项目下面的。如果我直接安装bcrypt,错误如下:** gyp WARN EACCES user “lu” does not have permission to access the dev dir "/root/.node-gyp/5.1.1" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/project/Ep/node_modules/bcrypt/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: socket hang up gyp ERR! stack at TLSSocket.onHangUp (_tls_wrap.js:1089:19) gyp ERR! stack at TLSSocket.g (events.js:260:16) gyp ERR! stack at emitNone (events.js:72:20) gyp ERR! stack at TLSSocket.emit (events.js:166:7) gyp ERR! stack at endReadableNT (_stream_readable.js:905:12) gyp ERR! stack at doNTCallback2 (node.js:452:9) gyp ERR! stack at process._tickCallback (node.js:366:17) gyp ERR! System Linux 3.10.0-229.el7.x86_64 gyp ERR! command “/usr/local/node/bin/node” “/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild" gyp ERR! cwd /usr/local/project/Ep/node_modules/bcrypt gyp ERR! node -v v5.1.1 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm ERR! Linux 3.10.0-229.el7.x86_64 npm ERR! argv “/usr/local/node/bin/node” “/usr/local/node/bin/npm” “install” "bcrypt" npm ERR! node v5.1.1 npm ERR! npm v3.3.12 npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.5 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@0.8.5 install script ‘node-gyp rebuild’. 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-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! /usr/local/project/Ep/npm-debug.log

1 回复

性能如果不太关心的话,用 http://npm.taobao.org/package/bcryptjs 试试

回到顶部