How to fix npm ERR! gyp ERR! find VS npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use in npm
This error occurs when node-gyp cannot locate a valid Visual Studio installation needed to compile native Node.js modules on Windows. You need the C++ build tools from Visual Studio, which can be installed or configured through several methods.
Quick fix
Fixes gyp ERR!
# For Visual Studio 2022
npm config set msvs_version=2022 --global
# For Visual Studio 2019
npm config set msvs_version=2019 --global- Install or modify Visual Studio with C++ workload
- Configure the msvs_version
- Update Node.js to a recent version
- Use windows-build-tools as an alternative
# For Visual Studio 2022npm config set msvs_version=2022 --global# For Visual Studio 2019npm config set msvs_version=2019 --globalnpm ERR! gyp ERR! find VSnpm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
What this error means
node-gyp is a tool that compiles native C++ modules for Node.js packages. When you install a package containing native code, npm automatically runs node-gyp. On Windows, node-gyp needs Visual Studio's C++ compiler and build tools. This error means node-gyp couldn't find a valid installation.
Typical symptoms
- npm install fails with the 'find VS' error when installing packages with native dependencies
- The error appears during the 'gyp configure' phase
- Packages that worked on other machines fail to install locally
- The error persists even after reinstalling Node.js
- Visual Studio is installed but npm still cannot detect it
Common causes
- Visual Studio is not installed or the C++ build tools are missing
- Visual Studio is installed but the 'Desktop development with C++' workload was not selected
- Your Node.js version is too old to recognize newer Visual Studio versions
- The msvs_version configuration is not set or points to a non-existent version
- Visual Studio installation is corrupted or incomplete
How to fix "npm ERR! gyp ERR! find VS npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use"
Download Visual Studio Community from https://visualstudio.microsoft.com/downloads/
If installing fresh:
1. Run the installer
2. Select 'Desktop development with C++' (this is critical)
3. Click 'Install' and wait for completion
4. Restart your computer
If already have Visual Studio:
1. Open 'Visual Studio Installer'
2. Click 'Modify'
3. Check 'Desktop development with C++'
4. Click 'Modify' to apply
Tell npm which version to use:
# For Visual Studio 2022
npm config set msvs_version=2022 --global
# For Visual Studio 2019
npm config set msvs_version=2019 --globalThen retry npm install.
If using Node.js older than v16, node-gyp may not recognize modern Visual Studio versions.
Download Node.js v18 LTS or later from https://nodejs.org
If you don't want the full Visual Studio IDE:
# Run as Administrator in PowerShell
npm install --global --production windows-build-toolsOr via Chocolatey:
choco install python visualstudio2022-workload-vctools -yAdvanced notes
Ensure your Node.js architecture (x64 vs ARM64) matches your system. Check with node -p "process.arch". WSL2 users: npm install may fail in Windows Subsystem for Linux if Visual Studio is only installed on the Windows host. Consider installing build-essential in WSL instead: sudo apt-get install build-essential python3.
Frequently asked questions
- What does "gyp ERR!" mean?
- js packages. When you install a package containing native code, npm automatically runs node-gyp. On Windows, node-gyp needs Visual Studio's C++ compiler and build tools.
- How do I fix "gyp ERR!"?
- This error occurs when node-gyp cannot locate a valid Visual Studio installation needed to compile native Node.js modules on Windows. You need the C++ build tools from Visual Studio, which can be installed or configured through several methods.
- What causes "gyp ERR!"?
- Visual Studio is not installed or the C++ build tools are missing Visual Studio is installed but the 'Desktop development with C++' workload was not selected Your Node.js version is too old to recognize newer Visual Studio versions
- Is the "gyp ERR!" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐node-gyp GitHub Repository(Official Docs)
- ๐node-gyp Windows Setup(Official Docs)
- ๐ฌStack Overflow: node-gyp Visual Studio(Stack Overflow)