前端使用vue-admin-template-master,在使用npm下載依賴的時候總報錯。
最開始我使用的時vue-admin-template-master是視頻資源,結果報錯,百度查不出來。我覺得有沒有可能是因為是版本老的問題,就去官網下載,還真解決了一部分bug,但是不夠,報錯如下
error code 1
error path F:\webstrom項目\SpringBoot大項目實戰\vue-admin-template-master\node_modules\deasync
error command failed
error command C:\WINDOWS\system32\cmd.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:\Users\asus\AppData\Local\Programs\Python\Python37\python.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:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
error gyp ERR! stack at C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
error gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
error gyp ERR! stack at C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
error gyp ERR! stack at C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
error gyp ERR! stack at C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
error gyp ERR! stack at C:\Users\asus\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.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\node_modules\deasync
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多的內存沒了,心痛。