node 小白遇到的问题,开源软件通过npm安装的时候有如下提示,
是否需要node-gyp rebuild
? 执行也是会有错误,
有了解的提示一下,谢谢!
aaa@node0:~/opensoc/opensoc-ui$ sudo npm install --production [sudo] password for aaa:
[email protected] install /home/aaa/opensoc/opensoc-ui/node_modules/bcrypt node-gyp rebuild
make: Entering directory '/home/aaa/opensoc/opensoc-ui/node_modules/bcrypt/build’
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
…/src/bcrypt_node.cc: In destructor 鈥?[01mvirtual {anonymous}::baton_base::~baton_base()鈥?
…/src/bcrypt_node.cc:54:18: error: 鈥?[01mclass v8::Persistentv8::Function鈥?has no member named 鈥?[01mDispose鈥?
callback.Dispose();
^
…/src/bcrypt_node.cc: At global scope:
…/src/bcrypt_node.cc:128:19: error: variable or field 鈥?[01mGenSaltAsync鈥?declared void
void GenSaltAsync(uv_work_t* req) {
^
…/src/bcrypt_node.cc:128:19: error: 鈥?[01muv_work_t鈥?was not declared in this scope
…/src/bcrypt_node.cc:128:30: error: 鈥?[01mreq鈥?was not declared in this scope
void GenSaltAsync(uv_work_t* req) {
^
…/src/bcrypt_node.cc:137:24: error: variable or field 鈥?[01mGenSaltAsyncAfter鈥?declared void
void GenSaltAsyncAfter(uv_work_t* req) {
^
…/src/bcrypt_node.cc:137:24: error: 鈥?[01muv_work_t鈥?was not declared in this scope
…/src/bcrypt_node.cc:137:35: error: 鈥?[01mreq鈥?was not declared in this scope
void GenSaltAsyncAfter(uv_work_t* req) {
^
…/src/bcrypt_node.cc:429:30: error: expected 鈥?[01m}鈥?at end of input
NODE_MODULE(bcrypt_lib, init);
^
…/src/bcrypt_node.cc:80:6: warning: 鈥?[01mbool {anonymous}::ValidateSalt(const char*)鈥?defined but not used [-Wunused-function]
bool ValidateSalt(const char* salt) {
^
bcrypt_lib.target.mk:96: recipe for target ‘Release/obj.target/bcrypt_lib/src/bcrypt_node.o’ failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
make: Leaving directory '/home/aaa/opensoc/opensoc-ui/node_modules/bcrypt/build’
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276: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 4.4.0-47-generic
gyp ERR! command “/usr/bin/nodejs” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild"
gyp ERR! cwd /home/aaa/opensoc/opensoc-ui/node_modules/bcrypt
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-47-generic
npm ERR! argv “/usr/bin/nodejs” “/usr/local/bin/npm” “install” "–production"
npm ERR! node v4.2.6
npm ERR! npm v4.0.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 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/aaa/opensoc/opensoc-ui/npm-debug.log
Make sure you have the latest version of node.js and npm installed If you do, this is most likely a problem with the bcrypt package
删除然后单独安装一下bcrypt
模块,升级一下gcc到4.8以上试试