首页 > 解决方案 > 通过依赖node-gyp的npm安装包失败

问题描述

每次我尝试通过 npm 在此特定项目上安装任何软件包时,都会出现此错误

*C:\Users\6030213004\Desktop\FAX2>npm install vue2-timepicker --save
npm ERR! code 1
npm ERR! path C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --loglevel http
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --loglevel=http --module=C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs\build\Release\xmljs.node --module_name=xmljs --module_path=C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs\build\Release --napi_version=7 --node_abi_napi=napi' (1)
npm ERR! node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.8/node-v88-win32-x64.tar.gz
npm ERR! node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.18.8/node-v88-win32-x64.tar.gz
npm ERR! node-pre-gyp ERR! Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.18.8/node-v88-win32-x64.tar.gz 
npm ERR! node-pre-gyp ERR! Pre-built binaries not found for libxmljs@0.18.8 and node@15.7.0 (node-v88 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp http 404 status code downloading tarball https://github.com/libxmljs/libxmljs/releases/download/v0.18.8/node-v88-win32-x64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@15.7.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS 
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:340:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:379:20)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1069:16)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\6030213004\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--loglevel=http" "--module=C:\\Users\\6030213004\\Desktop\\FAX2\\node_modules\\libxmljs\\build\\Release\\xmljs.node" "--module_name=xmljs" "--module_path=C:\\Users\\6030213004\\Desktop\\FAX2\\node_modules\\libxmljs\\build\\Release" "--napi_version=7" "--node_abi_napi=napi"
npm ERR! gyp ERR! cwd C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs
npm ERR! gyp ERR! node -v v15.7.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\6030213004\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --loglevel=http --module=C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs\build\Release\xmljs.node --module_name=xmljs --module_path=C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs\build\Release --napi_version=7 --node_abi_napi=napi' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\6030213004\Desktop\FAX2\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:379:20)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1069:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:300:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.18363
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\6030213004\\Desktop\\FAX2\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--loglevel" "http"
npm ERR! node-pre-gyp ERR! cwd C:\Users\6030213004\Desktop\FAX2\node_modules\libxmljs
npm ERR! node-pre-gyp ERR! node -v v15.7.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.9.1
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\6030213004\AppData\Local\npm-cache\_logs\2021-04-09T07_54_58_609Z-debug.log*

这里发生了什么?

我发现了一些有类似问题的人的线程,但他们的解决方案都没有奏效

我不知道这些信息是否可以帮助我的电脑在 windows10 操作系统上运行,我的节点版本是 15.7.0

标签: node.jsvue.jsnpmwebpacknpm-install

解决方案


推荐阅读