在 Mac 上使用 npm 安装 zmq 出现错误

时间:2021-02-11 07:50:55

标签: npm npm-install zeromq

npm ERR! code 1
npm ERR! path /Users/asd/node_modules/zmq
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/zmq/binding.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@15.8.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.1 found at "/usr/local/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/asd/.npm-global/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/asd/node_modules/zmq/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/asd/.npm-global/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/asd/Library/Caches/node-gyp/15.8.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/asd/Library/Caches/node-gyp/15.8.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/asd/.npm-global/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/asd/Library/Caches/node-gyp/15.8.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/asd/node_modules/zmq',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../binding.cc:29:
npm ERR! /usr/local/Cellar/zeromq/4.3.4/include/zmq_utils.h:42:32: warning: unknown warning group '-Werror', ignored [-Wunknown-warning-option]
npm ERR! #pragma GCC diagnostic ignored "-Werror"
npm ERR!                                ^
npm ERR! /usr/local/Cellar/zeromq/4.3.4/include/zmq_utils.h:45:9: warning: Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h. [-W#pragma-messages]
npm ERR! #pragma message(                                                               \
npm ERR!         ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:190:
npm ERR! ../node_modules/nan/nan_maybe_43_inl.h:88:15: error: no member named 'ForceSet' in 'v8::Object'
npm ERR!   return obj->ForceSet(GetCurrentContext(), key, value, attribs);
npm ERR!          ~~~  ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:195:
npm ERR! In file included from ../node_modules/nan/nan_converters.h:59:
npm ERR! ../node_modules/nan/nan_converters_43_inl.h:18:1: error: no viable conversion from 'v8::Local<v8::Context>' to 'v8::Isolate *'
npm ERR! X(Boolean)
npm ERR! ^~~~~~~~~~
npm ERR! ../node_modules/nan/nan_converters_43_inl.h:15:26: note: expanded from macro 'X'
npm ERR!   return val->To ## TYPE(GetCurrentContext());                                 \
npm ERR!                          ^~~~~~~~~~~~~~~~~~~
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:2894:37: note: passing argument to parameter 'isolate' here
npm ERR!   Local<Boolean> ToBoolean(Isolate* isolate) const;
npm ERR!                                     ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:195:
npm ERR! In file included from ../node_modules/nan/nan_converters.h:59:
npm ERR! ../node_modules/nan/nan_converters_43_inl.h:34:1: error: no viable conversion from 'v8::Local<v8::Context>' to 'v8::Isolate *'
npm ERR! X(bool, Boolean)
npm ERR! ^~~~~~~~~~~~~~~~
npm ERR! ../node_modules/nan/nan_converters_43_inl.h:31:29: note: expanded from macro 'X'
npm ERR!   return val->NAME ## Value(GetCurrentContext());                              \
npm ERR!                             ^~~~~~~~~~~~~~~~~~~
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:2904:30: note: passing argument to parameter 'isolate' here
npm ERR!   bool BooleanValue(Isolate* isolate) const;
npm ERR!                              ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:196:
npm ERR! In file included from ../node_modules/nan/nan_new.h:189:
npm ERR! ../node_modules/nan/nan_implementation_12_inl.h:107:42: error: no viable conversion from 'v8::Isolate *' to 'Local<v8::Context>'
npm ERR!   return scope.Escape(v8::Function::New( isolate
npm ERR!                                          ^~~~~~~
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:194:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Isolate *' to 'const v8::Local<v8::Context> &' for 1st argument
npm ERR! class Local {
npm ERR!       ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:194:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Isolate *' to 'v8::Local<v8::Context> &&' for 1st argument
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:198:13: note: candidate template ignored: could not match 'Local<type-parameter-0-0>' against 'v8::Isolate *'
npm ERR!   V8_INLINE Local(Local<S> that)
npm ERR!             ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:4492:22: note: passing argument to parameter 'context' here
npm ERR!       Local<Context> context, FunctionCallback callback,
npm ERR!                      ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:196:
npm ERR! In file included from ../node_modules/nan/nan_new.h:189:
npm ERR! ../node_modules/nan/nan_implementation_12_inl.h:345:37: error: too few arguments to function call, expected 2, have 1
npm ERR!   return v8::StringObject::New(value).As<v8::StringObject>();
npm ERR!          ~~~~~~~~~~~~~~~~~~~~~      ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:5900:3: note: 'New' declared here
npm ERR!   static Local<Value> New(Isolate* isolate, Local<String> value);
npm ERR!   ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:816:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
npm ERR!     return node::MakeCallback(
npm ERR!                  ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:183:1: note: 'MakeCallback' has been explicitly marked deprecated here
npm ERR! NODE_DEPRECATED("Use MakeCallback(..., async_context)",
npm ERR! ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:101:20: note: expanded from macro 'NODE_DEPRECATED'
npm ERR!     __attribute__((deprecated(message))) declarator
npm ERR!                    ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:830:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
npm ERR!     return node::MakeCallback(
npm ERR!                  ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:176:1: note: 'MakeCallback' has been explicitly marked deprecated here
npm ERR! NODE_DEPRECATED("Use MakeCallback(..., async_context)",
npm ERR! ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:101:20: note: expanded from macro 'NODE_DEPRECATED'
npm ERR!     __attribute__((deprecated(message))) declarator
npm ERR!                    ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:844:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
npm ERR!     return node::MakeCallback(
npm ERR!                  ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:169:1: note: 'MakeCallback' has been explicitly marked deprecated here
npm ERR! NODE_DEPRECATED("Use MakeCallback(..., async_context)",
npm ERR! ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/node.h:101:20: note: expanded from macro 'NODE_DEPRECATED'
npm ERR!     __attribute__((deprecated(message))) declarator
npm ERR!                    ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:890:53: error: too few arguments to function call, single argument 'context' was not specified
npm ERR!       v8::Local<v8::String> string = from->ToString();
npm ERR!                                      ~~~~~~~~~~~~~~ ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:2856:3: note: 'ToString' declared here
npm ERR!   V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
npm ERR!   ^
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
npm ERR! #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
npm ERR!                               ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:900:37: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'char *'
npm ERR!         length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
npm ERR!                                     ^~~~
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:3083:26: note: passing argument to parameter 'isolate' here
npm ERR!   int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
npm ERR!                          ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! ../node_modules/nan/nan.h:1371:43: error: no matching member function for call to 'Get'
npm ERR!     v8::Local<v8::Value> a = New(handle)->Get(kCallbackIndex);
npm ERR!                              ~~~~~~~~~~~~~^~~
npm ERR! /Users/asd/Library/Caches/node-gyp/15.8.0/include/node/v8.h:3763:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR!   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!                                           ^                                        ^
npm ERR! In file included from ../binding.cc:38:
npm ERR! In file included from ../node_modules/nan/nan.h:2192:
npm ERR! ../node_modules/nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
npm ERR!     assert(persistent().IsNearDeath());
npm ERR!            ~~~~~~~~~~~~ ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
npm ERR!     (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
npm ERR!                         ^
npm ERR! fatal error: too many errors emitted, stopping now [-ferror-limit=]
npm ERR! 6 warnings and 20 errors generated.
npm ERR! make: *** [Release/obj.target/zmq/binding.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/asd/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:378:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.3.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/asd/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/asd/node_modules/zmq
npm ERR! gyp ERR! node -v v15.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/asd/.npm/_logs/2021-02-11T07_04_41_883Z-debug.log

我的 node.js 版本是 15.x,我尝试安装 zmq。 我需要启动 stf 进行设备管理和测试。 Zeromq 是运行 stf 的依赖。

我尝试了这些步骤,但没有解决我的问题

使用 brew 安装 zmq : brew install zmq

export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.0.4/lib/pkgconfig/

sudo visudo

添加行 Defaults env_keep += "PKG_CONFIG_PATH"

sudo npm install zmq

我该如何解决这个问题?请帮帮我

0 个答案:

没有答案