npm下载前端vue-admin-template-master模板的依赖报错

前端使用vue-admin-template-master,在使用npm下载依赖的时候总报错。
最开始我使用的时vue-admin-template-master是视频资源,结果报错,百度查不出来。我觉得有没有可能是因为是版本老的问题,就去官网下载,还真解决了一部分bug,但是不够,报错如下

error code 1
error path F:webstrom项目SpringBoot大项目实战vue-admin-template-master
ode_modulesdeasync
error command failed
error command C:WINDOWSsystem32cmd.exe /d /s /c node-gyp rebuild
error gyp info it worked if it ends with ok
error gyp info using node-gyp@8.3.0
error gyp info using node@16.13.0 | win32 | x64
error gyp info find Python using Python version 3.7.7 found at "C:UsersasusAppDataLocalProgramsPythonPython37python.exe"
error gyp ERR! find VS
error gyp ERR! find VS msvs_version not set from command line or npm config
error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
error gyp ERR! find VS could not use PowerShell to find Visual Studio or newer, try re-running with '--loglevel silly' for more details
error gyp ERR! find VS looking for Visual Studio 2015
error gyp ERR! find VS - not found
error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
error gyp ERR! find VS
error gyp ERR! find VS **************************************************************
9800 error gyp ERR! find VS You need to install the latest version of Visual Studio
9800 error gyp ERR! find VS including the "Desktop development with C++" workload.
9800 error gyp ERR! find VS For more information consult the documentation at:
error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
error gyp ERR! find VS **************************************************************
error gyp ERR! find VS
error gyp ERR! configure error
error gyp ERR! stack Error: Could not find any Visual Studio installation to use
error gyp ERR! stack     at VisualStudioFinder.fail (C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:121:47)
error gyp ERR! stack     at C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:74:16
error gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:351:14)
error gyp ERR! stack     at C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:70:14
error gyp ERR! stack     at C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:372:16
error gyp ERR! stack     at C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:54:7
error gyp ERR! stack     at C:UsersasusAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:33:16
error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
error gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
error gyp ERR! System Windows_NT 10.0.19042
error gyp ERR! command "D:\node.js\node.exe" "C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
9800 error gyp ERR! cwd F:webstrom项目SpringBoot大项目实战vue-admin-template-master
ode_modulesdeasync
error gyp ERR! node -v v16.13.0
error gyp ERR! node-gyp -v v8.3.0
error gyp ERR! not ok
verbose exit 1

百度查出来的都是说node.js的版本过高,要降低版本。我下载的是官网的稳定版,不太想降低版本。

问题发现:通过翻译错误日志和百度解决了

**************************************************************
9800 error gyp ERR! find VS You need to install the latest version of Visual Studio
9800 error gyp ERR! find VS including the "Desktop development with C++" workload.
9800 error gyp ERR! find VS For more information consult the documentation at:
error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
error gyp ERR! find VS **************************************************************

解决问题:下载最新版本的Visual Studio,我下载的是Visual Studio2019
解决参考: https://www.cnblogs.com/irobotzz/p/12336767.html

感想:花了差不多三个小时才解决,C盘6G多的内存没了,心痛。

原文地址:https://www.cnblogs.com/13490-/p/15495970.html