我对Node.JS并不陌生,并且已经在Mac上成功安装了一些软件包。但是我正在尝试使用以下命令安装名为sbrick-protocol的模块:
npm install sbrick-protocol
我得到了各种我不理解的奇怪输出:
Last login: Wed Jan 1 17:00:38 on ttys000
Gemixin@iMac ~ % npm install sbrick-protocol
> xpc-connection@0.1.4 install /Users/Gemixin/node_modules/xpc-connection
> node-gyp rebuild
CXX(target) Release/obj.target/binding/src/XpcConnection.o
../src/XpcConnection.cpp:26:77: error: too few arguments to function call,
single argument 'context' was not specified
target->Set(Nan::New("XpcConnection").ToLocalChecked(), tmpl->GetFunction());
~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:6283:3: note:
'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:103:54: error: too few arguments to function call,
single argument 'context' was not specified
xpcObject = xpc_int64_create(value->IntegerValue());
~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2774:3: note:
'IntegerValue' declared here
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:113:49: error: too few arguments to function call,
single argument 'context' was not specified
Local<Object> valueObject = value->ToObject();
~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2754:3: note:
'ToObject' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:115:78: error: too few arguments to function call,
expected 2, have 1
if (valueObject->HasRealNamedProperty(Nan::New("isUuid").ToLocalChecked())) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3837:3: note:
'HasRealNamedProperty' declared here
V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:123:49: error: too few arguments to function call,
single argument 'context' was not specified
Local<Object> valueObject = value->ToObject();
~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2754:3: note:
'ToObject' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:135:40: error: no matching member function for call to
'GetPropertyNames'
Local<Array> propertyNames = object->GetPropertyNames();
~~~~~~~~^~~~~~~~~~~~~~~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3702:43: note:
candidate function not viable: requires single argument 'context', but no
arguments were provided
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3704:43: note:
candidate function not viable: requires at least 4 arguments, but 0 were
provided
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
^
../src/XpcConnection.cpp:138:48: error: no matching member function for call to
'Get'
Local<Value> propertyName = propertyNames->Get(i);
~~~~~~~~~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3594:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3597:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../src/XpcConnection.cpp:143:88: error: too few arguments to function call,
single argument 'context' was not specified
...propertyValue = object->GetRealNamedProperty(propertyName->ToString());
~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2750:3: note:
'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:160:33: error: no matching member function for call to
'Get'
Local<Value> value = array->Get(i);
~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3594:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3597:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../src/XpcConnection.cpp:200:13: error: no matching member function for call to
'Set'
object->Set(Nan::New<String>(key).ToLocalChecked(), XpcConnection::X...
~~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3547:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3550:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/XpcConnection.cpp:212:12: error: no matching member function for call to
'Set'
array->Set(Nan::New<Number>(index), XpcConnection::XpcObjectToValue(value));
~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3547:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3550:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/XpcConnection.cpp:254:12: warning: 'MakeCallback' is deprecated
[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").T...
^
../../nan/nan.h:1045:3: note: 'MakeCallback' has been explicitly marked
deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/XpcConnection.cpp:263:12: warning: 'MakeCallback' is deprecated
[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").T...
^
../../nan/nan.h:1045:3: note: 'MakeCallback' has been explicitly marked
deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
2 warnings and 11 errors generated.
make: *** [Release/obj.target/binding/src/XpcConnection.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/Gemixin/.nvm/versions/node/v13.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:305:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/Gemixin/.nvm/versions/node/v13.5.0/bin/node" "/Users/Gemixin/.nvm/versions/node/v13.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Gemixin/node_modules/xpc-connection
gyp ERR! node -v v13.5.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN gemixin@1.0.0 No description
npm WARN gemixin@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for bluetooth-hci-socket@0.5.1: wanted {"os":"linux,android,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ sbrick-protocol@3.0.0
updated 1 package and audited 464 packages in 6.624s
1 package is looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
我尝试按建议运行命令:
Gemixin@iMac ~ % npm fund
gemixin@1.0.0
└─┬ glob@7.1.6
└── url: https://github.com/sponsors/isaacs
然后:
npm audit fix
但这只是打印出了与原始安装命令类似的输出,结尾为:
fixed 0 of 1 vulnerability in 464 scanned packages
1 vulnerability required manual review and could not be updated
已经在我的modules文件夹中创建了文件夹“ sbrick-protocol”,所以我认为我会尝试使用它运行一个简单的JS程序,但是我得知它缺少模块“ xpc-connection”。因此,我尝试运行npm install xpc-connection
,得到的输出与之前类似:
Gemixin@iMac ~ % npm install xpc-connection
> xpc-connection@0.1.4 install /Users/Gemixin/node_modules/xpc-connection
> node-gyp rebuild
CXX(target) Release/obj.target/binding/src/XpcConnection.o
../src/XpcConnection.cpp:26:77: error: too few arguments to function call,
single argument 'context' was not specified
target->Set(Nan::New("XpcConnection").ToLocalChecked(), tmpl->GetFunction());
~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:6283:3: note:
'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:103:54: error: too few arguments to function call,
single argument 'context' was not specified
xpcObject = xpc_int64_create(value->IntegerValue());
~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2774:3: note:
'IntegerValue' declared here
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:113:49: error: too few arguments to function call,
single argument 'context' was not specified
Local<Object> valueObject = value->ToObject();
~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2754:3: note:
'ToObject' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:115:78: error: too few arguments to function call,
expected 2, have 1
if (valueObject->HasRealNamedProperty(Nan::New("isUuid").ToLocalChecked())) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3837:3: note:
'HasRealNamedProperty' declared here
V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:123:49: error: too few arguments to function call,
single argument 'context' was not specified
Local<Object> valueObject = value->ToObject();
~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2754:3: note:
'ToObject' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:135:40: error: no matching member function for call to
'GetPropertyNames'
Local<Array> propertyNames = object->GetPropertyNames();
~~~~~~~~^~~~~~~~~~~~~~~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3702:43: note:
candidate function not viable: requires single argument 'context', but no
arguments were provided
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3704:43: note:
candidate function not viable: requires at least 4 arguments, but 0 were
provided
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
^
../src/XpcConnection.cpp:138:48: error: no matching member function for call to
'Get'
Local<Value> propertyName = propertyNames->Get(i);
~~~~~~~~~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3594:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3597:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../src/XpcConnection.cpp:143:88: error: too few arguments to function call,
single argument 'context' was not specified
...propertyValue = object->GetRealNamedProperty(propertyName->ToString());
~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:2750:3: note:
'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8config.h:419:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../src/XpcConnection.cpp:160:33: error: no matching member function for call to
'Get'
Local<Value> value = array->Get(i);
~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3594:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3597:43: note:
candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../src/XpcConnection.cpp:200:13: error: no matching member function for call to
'Set'
object->Set(Nan::New<String>(key).ToLocalChecked(), XpcConnection::X...
~~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3547:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3550:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/XpcConnection.cpp:212:12: error: no matching member function for call to
'Set'
array->Set(Nan::New<Number>(index), XpcConnection::XpcObjectToValue(value));
~~~~~~~^~~
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3547:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/Gemixin/Library/Caches/node-gyp/13.5.0/include/node/v8.h:3550:37: note:
candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/XpcConnection.cpp:254:12: warning: 'MakeCallback' is deprecated
[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").T...
^
../../nan/nan.h:1045:3: note: 'MakeCallback' has been explicitly marked
deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/XpcConnection.cpp:263:12: warning: 'MakeCallback' is deprecated
[-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").T...
^
../../nan/nan.h:1045:3: note: 'MakeCallback' has been explicitly marked
deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
2 warnings and 11 errors generated.
make: *** [Release/obj.target/binding/src/XpcConnection.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/Gemixin/.nvm/versions/node/v13.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:305:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/Gemixin/.nvm/versions/node/v13.5.0/bin/node" "/Users/Gemixin/.nvm/versions/node/v13.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Gemixin/node_modules/xpc-connection
gyp ERR! node -v v13.5.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN gemixin@1.0.0 No description
npm WARN gemixin@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for bluetooth-hci-socket@0.5.1: wanted {"os":"linux,android,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xpc-connection@0.1.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xpc-connection@0.1.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Gemixin/.npm/_logs/2020-01-01T17_40_53_996Z-debug.log
有人能指出我正确的方向吗?
答案 0 :(得分:3)
我将Node.JS降级到8.15.1版,并且可以正常工作。
答案 1 :(得分:3)
因此,该库中显然包含install
正在尝试编译的一些本机附加代码。而且,它收到了很多警告/错误,我想这意味着它是为比您使用的旧版本的node.js编写的。它以生成错误结束,因此无法正确创建所需的目标。我建议对该库的节点版本兼容性进行一些搜索。或联系作者并询问。
在查看github存储库时,它似乎没有经过3年的有意义的更新,因此您可能必须尝试使用旧版本的node.js或找到其他库。
注意:您可能需要三思而后行地将项目建立在一个未维护的库(尤其是一个附加组件并使用本机代码的库)的基础上,除非您计划自己维护它以便可以在将来的node.js版本中使用