Last updated: Apr 4, 2024
Reading timeยท4 min
To solve the "npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio" error:
npm
version to the latest.node_modules
and package-lock.json
files and rerun
npm install
.Here is the stack trace from the error.
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! Visual Studio C++ core features missing 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 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! For more information consult the documentation at: https://github.com/nodejs/node-gyp#on-windows 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! not ok
As the error message states:
If you already have Visual Studio installed:
Click on "Modify".
Tick the "Desktop development with C++" option and click on "Modify".
If the error persists, try to delete your node_modules
and package-lock.json
files.
If the error is not resolved, try to delete your node_modules
and
package-lock.json
(not package.json
) files, re-run npm install
and restart
your IDE.
# ๐๏ธ (Windows) delete node_modules and package-lock.json rd /s /q "node_modules" del package-lock.json # ๐๏ธ (macOS/Linux) delete node_modules and package-lock.json rm -rf node_modules rm -f package-lock.json # ๐๏ธ clean your npm cache npm cache clean --force # ๐๏ธ install packages npm install
Make sure to restart your IDE and shell if the error persists. Visual Studio Code often glitches and a reboot solves things sometimes.
If the error persists, try to update your npm
and Node.js versions or use
nvm
to manage your Node.js version.
npm
and Node.js versions or use nvm
First, update your NPM version by running the following command.
npm install -g npm@latest # ๐๏ธ If you get a permissions error on macOS / Linux sudo npm install -g npm@latest
If you get a permissions error on Windows, open CMD as an administrator and rerun the command.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
npm install -g npm@latest npm install -g npm@latest --force
If that didn't help, try to download and install the long-term supported version of Node.js.
To install Node:
Next
on the Welcome screen.Next
.Next
.Next
.Next
.Install
button.Finish
button.Make sure to close any existing command prompts and PowerShell instances for
the PATH
variable to get updated.
You can start a new CMD shell and use the npm --version
command to make
sure Node is installed.
npm --version node --version npm install -g npm@latest
If the error is not resolved, try to restart your PC after installing the LTS version of Node.
nvm
if you need to manage multiple Node.js versionsIf you need to manage multiple Node.js versions, you can use the nvm
package.
There are 2 nvm
packages:
I have written detailed, step-by-step guides on how to install NVM on Windows and macOS or Linux:
Make sure to follow the step-by-step instructions. Once you switch to the long-term supported Node.js version, the error will be resolved.