Reputation: 19
I am trying to install Node JS and as of writing this, chocolatey still defaults to Visual Studio 2019 build tools.
I want to ask if it is possible via any simple method to use the VS 2022 build tools instead of the 2019 ones, since they are quite old now.
I tried to install Node JS latest and wanted an option to use the VS 2022 build tools instead of 2019.
Upvotes: 0
Views: 1969
Reputation: 19
The way i got it to work was to
1- Install NodeJS once
2- Go to the nodejs installation directory open the ./build_tools.bat via an editor. Replace visualstudio2019-workload-vctools with visualstudio2022-workload-vctools.
3-Copying this new script outside the folder.
4- Uninstalling NODEJS
5- Begin a new installation, check the install chocolatey prompt on the installation .
6- Do not click finish
7- Copy the old script into the nodjs directory, WHILE keeping the installation program open.
8- Clicking finish to now install chocolatey as usual but now chocolatey will download and install vs 22 rather than 2019
Upvotes: -1
Reputation: 1946
It looks like Node.js is opting to install the visualstudio2019-workload-vctools package. Given you've now got Chocolatey CLI installed, you can use it to also install the visualstudio2022-workload-vctools package like this from an elevate command prompt:
choco install visualstudio2022-workload-vctools
If you want to get rid of the 2019 tools, you can do that via Chocolatey as well:
choco uninstall visualstudio2019-workload-vctools
Note, there may be a reason Node.js is still installing the older tools. If needed you can always uninstall the 2022 version and re-install 2019 (just swap around the commands above as required.)
Upvotes: 3