我正在尝试使用npm install
命令安装所有依赖项,但是在安装过程中却出现如下错误:
ling source file ..\src\threaded_callback_invokation.cc)
c:\applatest\applatest\node_modules\nan\nan.h(1478): warning C4996: 'node::MakeCallback': was declared deprecated (comp
iling source file ..\src\threaded_callback_invokation.cc) [C:\appLatest\appLatest\node_modules\voicemeeter\node_modules
\ffi\build\ffi_bindings.vcxproj]
c:\users\alliancetek\.node-gyp\10.15.0\include\node\node.h(176): note: see declaration of 'node::MakeCallback' (compi
ling source file ..\src\threaded_callback_invokation.cc)
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\appLatest\appLatest\node_modules\voicemeeter\node_modules\ffi
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@1.3.1 (node_modules\7zip-bin-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.3.1: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-mac@1.0.1 (node_modules\7zip-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-mac@1.0.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ffi@2.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ffi@2.2.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\alliancetek\AppData\Roaming\npm-cache\_logs\2019-02-05T10_40_31_378Z-debug.log
在许多解决方案中,我都尝试过npm install node-gyp
或再次将其卸载或安装,但是我遇到了同样的错误。
也可以尝试以下步骤:
并尝试使用npm install --production windows-build-tools
,但任何选择都没有结果。
尝试了所有解决方案,但没有任何解决方法。我已经安装了带有2.7.15的python,vc ++构建工具,Visual Studio 2017和所有必需的组件。
我正在寻找最近2周的解决方案,请为我建议正确的答案
答案 0 :(得分:1)
npm install --production windows-build-tools
可能需要更长的时间来安装,为我的朋友工作或
答案 1 :(得分:0)
答案 2 :(得分:0)
这些答案都无法在Windows 10和Node 13上工作。我必须卸载Visual Studio和Build Tools,再卸载Node13。然后,在重新安装Node 11.6并选择之前,我从漫游中删除了npm和npm-cache。安装Chocolately。此后对我有用。
答案 3 :(得分:0)
您可以尝试将 Node.js 降级到旧版本,我使用的是 v14.16.1LTS 版本。 切换到 v10.24.1 后,它起作用了。
要更改您的节点版本,请检查 How to change to an older version of Node.js
记得先删除您的 node_modules
文件夹和 package-lock.json
或 yarn.lock
您也可以尝试从 yarn 切换到 npm 或从 npm 切换到 yarn。
答案 4 :(得分:-1)
在具有管理员权限的cmd中运行以下命令:
npm install --global --production windows-build-tools --vs2017