我试图使用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
,或卸载/重新安装它,但我仍然遇到相同的错误。
还可以尝试以下步骤:
- 安装最新版本的Python(可能与问题无关),以及"Microsoft Visual C++ Redistributable for Visual Studio 2017"、Node.js和NPM;
- 管理员身份运行: $ cd "C:\Program Files\nodejs\node_modules\npm" $ npm install node-gyp
- $ npm config set msvs_version 2015 --global 请注意,我有VS 2017,但将其配置为版本2017不起作用。不确定为什么。
- 管理员身份运行: $ npm install -g node-sass 最后,请再进行一次检查: $ node-sass -v
并且尝试使用npm install --production windows-build-tools
,但任何选项都没有结果。
我已经尝试了所有的解决方案,但都没有成功。我已经安装了Python 2.7.15、VC++构建工具、Visual Studio 2017和所有必需的组件。
我已经寻找了两个星期的解决方案,请给我提供正确的答案。
npm install
,那么你正在安装项目中 package.json 文件所列出的依赖项。请与我们分享这个 package.json 文件。 - Mathyn