NodeJS Angular从版本14升级到版本15

vjrehmav  于 2023-08-04  发布在  Node.js
关注(0)|答案(1)|浏览(266)

我正在尝试将Angular版本从14.2.11更新到15.x.x。但是,在运行update命令(ng update @angular/core@15@angular/cli@15)时,我得到以下错误:

gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2022
npm ERR! gyp ERR! find VS running in VS Command Prompt, installation path is:
npm ERR! gyp ERR! find VS "C:\Users\my_name\AppData\Local\Microsoft"
npm ERR! gyp ERR! find VS - will only use this version
npm ERR! gyp ERR! find VS checking VS2022 (17.6.33815.320) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS checking VS2022 (17.6.33815.320) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v143
npm ERR! gyp ERR! find VS - found Windows SDK: 10.0.20348.0
npm ERR! gyp ERR! find VS - does not match this Visual Studio Command Prompt
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
npm ERR! gyp ERR! find VS - could not find MSBuild in registry for this version
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 msvs_version does not match this VS Command Prompt or the
npm ERR! gyp ERR! find VS installation cannot be used.
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

字符串
版本详情:

Node : 18.12.1
TypeScript: 4.8.2
node-gyp: 8.4.1
node-sass: 8.0.0
npm: 8.19.2


运行npm config list得到以下输出:

; "builtin" config from C:\Users\my_name\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\my_name\\AppData\\Roaming\\npm"

; "global" config from C:\Users\my_name\AppData\Roaming\npm\etc\npmrc

; msbuild_path = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\MSBuild.exe" ; overridden by user
python = "C:\\Users\\my_name\\AppData\\Local\\Programs\\Python\\Python39"

; "user" config from C:\Users\my_name\.npmrc

Files\Microsoft = "Visual"
msbuild_path = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\MSBuild.exe"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.12.1
; npm local prefix = C:\Users\my_name
; npm version = 8.19.2
; cwd = C:\Users\my_name
; HOME = C:\Users\my_name
; Run `npm config ls -l` to show all defaults.

2lpgd968

2lpgd9681#

我能够解决这个问题,只需卸载node-sass包并只安装sass。看起来node-sass在新的angular版本中被弃用了。

相关问题