Node.js 使用npm安装bcrypt时出错

Node.js 使用npm安装bcrypt时出错,node.js,npm,bcrypt,Node.js,Npm,Bcrypt,我无法在我的计算机上使用npm进行安装,因为我遇到以下错误。我一直在解决这个问题,运气不太好。您能推荐一些步骤来诊断或修复问题,以便我可以成功运行npm install bcrypt Someones-Macbook:node_modules Cody$ npm install bcrypt npm WARN package.json grunt-contrib-htmlmin@0.1.3 No README data | > bcrypt@0.7.7 install /Applicati

我无法在我的计算机上使用
npm
进行安装,因为我遇到以下错误。我一直在解决这个问题,运气不太好。您能推荐一些步骤来诊断或修复问题,以便我可以成功运行
npm install bcrypt

Someones-Macbook:node_modules Cody$ npm install bcrypt
npm WARN package.json grunt-contrib-htmlmin@0.1.3 No README data
|
> bcrypt@0.7.7 install /Applications/MAMP/htdocs/richintime/ultimate-seed/node_modules/bcrypt
> node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
  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:118:18: error: no member named 'Dispose' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function>
      >'
        callback.Dispose();
        ~~~~~~~~ ^
../src/bcrypt_node.cc:202:19: error: unknown type name 'uv_work_t'
void GenSaltAsync(uv_work_t* req) {
                  ^
../src/bcrypt_node.cc:219:24: error: unknown type name 'uv_work_t'
void GenSaltAsyncAfter(uv_work_t* req) {
                       ^
../src/bcrypt_node.cc:220:17: error: calling a protected constructor of class 'v8::HandleScope'
    HandleScope scope;
                ^
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/bcrypt_node.cc:228:44: error: no member named 'New' in 'v8::String'
        argv[0] = Exception::Error(String::New(baton->error.c_str()));
                                   ~~~~~~~~^
../src/bcrypt_node.cc:229:19: error: no matching function for call to 'Undefined'
        argv[1] = Undefined();
                  ^~~~~~~~~
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: candidate function not viable: requires single argument 'isolate', but no
      arguments were provided
  friend Handle<Primitive> Undefined(Isolate* isolate);
                           ^
../src/bcrypt_node.cc:232:19: error: no matching function for call to 'Undefined'
        argv[0] = Undefined();
                  ^~~~~~~~~
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: candidate function not viable: requires single argument 'isolate', but no
      arguments were provided
  friend Handle<Primitive> Undefined(Isolate* isolate);
                           ^
../src/bcrypt_node.cc:238:20: error: member reference type 'v8::Persistent<v8::Function>' is not a pointer; maybe you meant to use '.'?
    baton->callback->Call(Context::GetCurrent()->Global(), 2, argv);
    ~~~~~~~~~~~~~~~^~
                   .
../src/bcrypt_node.cc:238:22: error: no member named 'Call' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function> >'
    baton->callback->Call(Context::GetCurrent()->Global(), 2, argv);
    ~~~~~~~~~~~~~~~  ^
../src/bcrypt_node.cc:238:36: error: no member named 'GetCurrent' in 'v8::Context'
    baton->callback->Call(Context::GetCurrent()->Global(), 2, argv);
                          ~~~~~~~~~^
../src/bcrypt_node.cc:246:34: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
Handle<Value> GenerateSalt(const Arguments &args) {
                                 ^~~~~~~~~
                                 v8::internal::Arguments
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/bcrypt_node.cc:247:17: error: calling a protected constructor of class 'v8::HandleScope'
    HandleScope scope;
                ^
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/bcrypt_node.cc:249:32: error: type 'const v8::internal::Arguments' does not provide a subscript operator
    const ssize_t rounds = args[0]->Int32Value();
                           ~~~~^~
../src/bcrypt_node.cc:250:30: error: type 'const v8::internal::Arguments' does not provide a subscript operator
    const int rand_len = args[1]->Int32Value();
                         ~~~~^~
../src/bcrypt_node.cc:251:58: error: type 'const v8::internal::Arguments' does not provide a subscript operator
    Local<Function> callback = Local<Function>::Cast(args[2]);
                                                     ~~~~^~
../src/bcrypt_node.cc:255:45: error: 'New' is a private member of 'v8::PersistentBase<v8::Function>'
    baton->callback = Persistent<Function>::New(callback);
                                            ^
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:572:23: note: declared private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../src/bcrypt_node.cc:255:57: error: too few arguments to function call, expected 2, have 1
    baton->callback = Persistent<Function>::New(callback);
                      ~~~~~~~~~~~~~~~~~~~~~~~~~         ^
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8.h:572:3: note: 'New' declared here
  V8_INLINE static T* New(Isolate* isolate, T* that);
  ^
/Users/Cody/.node-gyp/0.12.0/deps/v8/include/v8config.h:289:20: note: expanded from macro 'V8_INLINE'
# define V8_INLINE inline __attribute__((always_inline))
                   ^
../src/bcrypt_node.cc:259:5: error: unknown type name 'uv_work_t'
    uv_work_t* req = new uv_work_t;
    ^
../src/bcrypt_node.cc:259:26: error: unknown type name 'uv_work_t'
    uv_work_t* req = new uv_work_t;
                         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
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:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Applications/MAMP/htdocs/richintime/ultimate-seed/node_modules/bcrypt
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "bcrypt"
npm ERR! node v0.12.0
npm ERR! npm  v2.7.1
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.7.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.7.7 install script 'node-gyp rebuild'.
npm ERR! 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
Someone Macbook:node_模块Cody$npm安装bcrypt
npm WARN package.json grunt contrib-htmlmin@0.1.3没有自述文件数据
|
> bcrypt@0.7.7安装/Applications/MAMP/htdocs/richintime/ultimate seed/node_modules/bcrypt
>节点gyp重建
子进程:不推荐使用customFds选项,请改用stdio。
CXX(target)Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(目标)发布/obj.target/bcrypt_lib/src/bcrypt.o
CXX(目标)发布/obj.target/bcrypt_lib/src/bcrypt_node.o
../src/bcrypt_node.cc:118:18:错误:“v8::Persistent”中没有名为“Dispose”的成员
callback.Dispose();
~~~~~~~~ ^
../src/bcrypt_node.cc:202:19:错误:未知类型名称“uv_工作”
无效同步(紫外线工作要求){
^
../src/bcrypt_node.cc:219:24:错误:未知类型名称“uv_工作”
之后无效(紫外线工作要求){
^
../src/bcrypt_node.cc:220:17:错误:调用类“v8::HandleScope”的受保护构造函数
手镜镜;
^
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:816:13:注意:此处声明受保护
V8_内联手柄镜(){}
^
../src/bcrypt_node.cc:228:44:错误:“v8::String”中没有名为“New”的成员
argv[0]=Exception::Error(字符串::New(baton->Error.c_str());
~~~~~~~~^
../src/bcrypt_node.cc:229:19:错误:没有用于调用“未定义”的匹配函数
argv[1]=未定义();
^~~~~~~~~
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:305:28:注意:候选函数不可行:需要单参数“隔离”,但不需要
提供了论据
友元句柄未定义(隔离*隔离);
^
../src/bcrypt_node.cc:232:19:错误:对“未定义”的调用没有匹配的函数
argv[0]=未定义();
^~~~~~~~~
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:305:28:注意:候选函数不可行:需要单参数“隔离”,但不需要
提供了论据
友元句柄未定义(隔离*隔离);
^
../src/bcrypt_node.cc:238:20:错误:成员引用类型“v8::Persistent”不是指针;您可能想使用“.”?
指挥棒->回调->调用(Context::GetCurrent()->Global(),2,argv);
~~~~~~~~~~~~~~~^~
.
../src/bcrypt_node.cc:238:22:错误:在“v8::Persistent”中没有名为“Call”的成员
指挥棒->回调->调用(Context::GetCurrent()->Global(),2,argv);
~~~~~~~~~~~~~~~  ^
../src/bcrypt_node.cc:238:36:错误:“v8::Context”中没有名为“GetCurrent”的成员
指挥棒->回调->调用(Context::GetCurrent()->Global(),2,argv);
~~~~~~~~~^
../src/bcrypt_node.cc:246:34:错误:未知类型名称“Arguments”;您的意思是“v8::internal::Arguments”吗?
句柄GenerateSalt(常量参数和参数){
^~~~~~~~~
v8::内部::参数
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:127:7:注意:此处声明了:“v8::internal::Arguments”
类参数;
^
../src/bcrypt_node.cc:247:17:错误:调用类“v8::HandleScope”的受保护构造函数
手镜镜;
^
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:816:13:注意:此处声明受保护
V8_内联手柄镜(){}
^
../src/bcrypt_node.cc:249:32:错误:类型“const v8::internal::Arguments”未提供下标运算符
const ssize_t rounds=args[0]->Int32Value();
~~~~^~
../src/bcrypt_node.cc:250:30:错误:类型“const v8::internal::Arguments”未提供下标运算符
常量int rand_len=args[1]->Int32Value();
~~~~^~
../src/bcrypt_node.cc:251:58:错误:类型“const v8::internal::Arguments”未提供下标运算符
本地回调=Local::Cast(args[2]);
~~~~^~
../src/bcrypt_node.cc:255:45:错误:“New”是“v8::PersistentBase”的私有成员
baton->callback=Persistent::New(回调);
^
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:572:23:注意:此处声明为私有
V8_内联静态T*新(隔离*隔离,T*那个);
^
../src/bcrypt_node.cc:255:57:错误:函数调用的参数太少,预期为2,实际为1
baton->callback=Persistent::New(回调);
~~~~~~~~~~~~~~~~~~~~~~~~~         ^
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8.h:572:3:注意:此处声明了“New”
V8_内联静态T*新(隔离*隔离,T*那个);
^
/Users/Cody/.node gyp/0.12.0/deps/v8/include/v8config.h:289:20:注意:从宏“v8_INLINE”展开
#定义V8_内联_属性_uu((始终_内联))
^
../src/bcrypt\u node.cc:259:5:错误:未知类型名称“uv\u工作”
紫外线工作*req=新紫外线工作*;
^
../src/bcrypt\u node.cc:259:26:错误:未知类型名称“uv\u工作”
紫外线工作*req=新紫外线工作*;
^
致命错误:发出的错误太多,正在停止[-ferror limit=]
产生了20个错误。
make:**[Release/obj.target/bcrypt_lib/src/bcrypt_node.o]错误1
gyp错误!生成错误
gyp ERR!堆栈错误:`make`失败,退出代码:2
gyp ERR!在ChildProcess.onExit(/usr/local/lib/node_modules/npm/node_modules/node gyp/lib/build.js:267:23)处堆栈
ChildProcess.emit(events.js:110:17)上的gyp ERR!堆栈
gyp ERR!在Process.ChildProcess.\u handle.onexit(child\u Process.js:1067:12)处堆栈
gyp ERR!系统达尔文13.4.0
gyp ERR!命令“node”“/usr/local/lib/node_modules/npm/node_modules/node gyp/bin/node gyp.js”“重建”
绞股蓝
npm install --save bcryptjs && npm uninstall --save bcrypt
npm install -g node-gyp
npm install --g --production windows-build-tools
npm install bcrypt
npm install --g --production windows-build-tools
npm install node-pre-gyp -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
npm install --g --production windows-build-tools
npm install --save bcrypt
npm rebuild
npm install bcrypt
  npm install --global --production windows-build-tools
npm install node-gyp
npm install bcrypt
npm install node-gyp
npm --save install bcrypt
yarn add bcrypt-nodejs
yarn remove bcrypt-nodejs
yarn add bcrypt 
✔️ npm install -g node-gyp
❌ npm install --g --production windows-build-tools
✔️ npm install -g node-gyp
npm install bcrypt
sudo apt install build-essential
npm install
    npm uninstall bcrypt
    npm install bcrypt