首页 > 解决方案 > 为什么我不能使用 npm 安装这个模块?

问题描述

我对 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

文件夹“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

谁能指出我正确的方向?

标签: javascriptnode.jsnpm

解决方案


因此,该库中显然有一些install试图编译的本机附加代码。而且,它收到了很多警告/错误,我猜这意味着它是为比您使用的旧版本的 node.js 编写的。它以构建错误结束,因此未正确创建所需的目标。我建议对该库的节点版本兼容性进行一些搜索。或者联系作者询问。

在查看 github 存储库时,它看起来在 3 年内没有进行有意义的更新,因此您可能必须尝试使用​​旧版本的 node.js 或查找不同的库。

注意:您可能需要三思而后行,将项目基于未维护的库(尤其是作为附加组件并使用本机代码的库),除非您计划自己维护它,以便它可以与未来版本的 node.js 一起使用。


推荐阅读