尽管已安装npm,但npm install会引发错误

时间:2019-12-11 21:23:38

标签: node.js npm

我的系统上安装了npm,npm -v给出了我的6.13.4,但是使用“ npm install”命令给了我和错误,下面可以看到其中的一部分。请指教。

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\git\ps\ps\node_modules\sinek\node_modules\node-rdkafka
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN notsup Unsupported engine for node-rdkafka@2.7.0: wanted: {"node":"<=10"} (current: {"node":"12.13.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: node-rdkafka@2.7.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inotify@1.4.6 (node_modules\inotify):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rdkafka@2.7.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rdkafka@2.7.0 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!     C:\Users\AppData\Roaming\npm-cache\_logs\2019-12-11T21_18_12_459Z-debug.log

1 个答案:

答案 0 :(得分:0)

问题不在于npm。该软件包node-rdkafka@2.7.0附带了系统的当前节点版本。

node-rdkafka仅支持节点版本<= 10。

您正在运行12.13.1

您可以使用nvm(节点版本管理器)安装节点10,也可以尝试安装兼容版本的node-rdafka。 node-rdafka的12.x功能的工作仍在进行中。