下载某些NPM软件包时出错

时间:2020-06-06 18:33:06

标签: node.js npm

我正在尝试下载某些程序包,例如node-portaudio和image-to-ascii,但是出现错误。尽管有许多其他软件包正在下载,但没有任何错误。 显示的错误是:


> node-portaudio@0.4.10 install /home/ex-machina/Desktop/Project/node_modules/node-portaudio
> node-gyp rebuild

make: Entering directory '/home/ex-machina/Desktop/Project/node_modules/node-portaudio/build'
  COPY ../build/Release/libportaudio.so.2
  CXX(target) Release/obj.target/node_pa/src/node_pa.o
  CXX(target) Release/obj.target/node_pa/src/GetDevices.o
  CXX(target) Release/obj.target/node_pa/src/AudioIn.o
In file included from ../src/AudioIn.cc:20:0:
../src/Params.h: In member function ‘std::__cxx11::string streampunk::Params::unpackValue(v8::Local<v8::Value>)’:
../src/Params.h:41:48: warning: ‘v8::Local<v8::Value> v8::Object::Get(uint32_t)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     return *String::Utf8Value(valueArray->Get(0));
                                                ^
In file included from /home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8-internal.h:14:0,
                 from /home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:27,
                 from /home/ex-machina/.cache/node-gyp/12.17.0/include/node/node.h:67,
                 from ../../nan/nan.h:56,
                 from ../src/AudioIn.cc:16:
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:3557:51: note:declared here
   V8_DEPRECATED("Use maybe version", Local<Value> Get(uint32_t index));
                                                   ^
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/AudioIn.cc:20:0:
../src/Params.h:41:49: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     return *String::Utf8Value(valueArray->Get(0));
                                                 ^
In file included from /home/ex-machina/.cache/node-gyp/12.17.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/AudioIn.cc:16:
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/AudioIn.cc:20:0:
../src/Params.h: In member function ‘std::__cxx11::string streampunk::Params::unpackStr(v8::Local<v8::Object>, const string&, std::__cxx11::string)’:
../src/Params.h:64:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>&)’
       result = *String::Utf8Value(val);
                                      ^
In file included from /home/ex-machina/.cache/node-gyp/12.17.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/AudioIn.cc:16:
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:3135:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/ex-machina/.cache/node-gyp/12.17.0/include/node/v8.h:3135:5: note:   candidate expects 2 arguments, 1 provided
node_pa.target.mk:128: recipe for target 'Release/obj.target/node_pa/src/AudioIn.o' failed
make: *** [Release/obj.target/node_pa/src/AudioIn.o] Error 1
make: Leaving directory '/home/ex-machina/Desktop/Project/node_modules/node-portaudio/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ex-machina/.nvm/versions/node/v12.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-51-generic
gyp ERR! command "/home/ex-machina/.nvm/versions/node/v12.17.0/bin/node" "/home/ex-machina/.nvm/versions/node/v12.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ex-machina/Desktop/Project/node_modules/node-portaudio
gyp ERR! node -v v12.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN project@1.0.0 No description
npm WARN project@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-portaudio@0.4.10 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-portaudio@0.4.10 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!     /home/ex-machina/.npm/_logs/2020-06-06T18_22_49_191Z-debug.log

我不明白怎么了。仅少数软件包正在发生这种情况。我试过添加sudo,但是不起作用。该如何解决?

1 个答案:

答案 0 :(得分:1)

此错误可能是由于计算机上安装了Node JS版本。您可以尝试更新版本还是检查该插件支持的版本

相关问题