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 但它不起作用。如何解决这个问题?
解决方案
此错误可能是因为您的机器上安装了 Node JS 版本。您可以尝试更新版本或检查该插件支持的版本吗
推荐阅读
- python - 在 groupby 之后确定两个类型是否在时间范围内出现
- python - 从 pandas DataFrame 在 pyomo 中定义参数
- sql-server - Cognos Audit 数据库中的参数
- python - 合并两个列表以在 python 中获得所需的输出
- algorithm - 如何从中间搜索尝试
- python - Django Rest 使用 pytest 测试状态代码
- jquery - Jquery datastring var返回未定义
- c++ - 虽然这个简单的 C++ 程序打印 2 的幂,但它有这么多问题吗?
- reactjs - 如何在 Reactjs 16.7.0 中使用异步服务器调用
- ms-access - 为什么需要循环来更改 Access VBA 中的记录集?