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

npmINTERMEDIATEHIGHUpdated Dec 3, 2025ยท 260 views

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
  1. Install or modify Visual Studio with C++ workload
  2. Configure the msvs_version
  3. Update Node.js to a recent version
  4. Use windows-build-tools as an alternative
npm โ€” error
# For Visual Studio 2022
npm config set msvs_version=2022 --global
# For Visual Studio 2019
npm config set msvs_version=2019 --global
npm ERR! gyp ERR! find VS
npm 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

  1. Visual Studio is not installed or the C++ build tools are missing
  2. Visual Studio is installed but the 'Desktop development with C++' workload was not selected
  3. Your Node.js version is too old to recognize newer Visual Studio versions
  4. The msvs_version configuration is not set or points to a non-existent version
  5. 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"

1Install or modify Visual Studio with C++ workload

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

2Configure the msvs_version

Tell npm which version to use:

bash
# For Visual Studio 2022
npm config set msvs_version=2022 --global

# For Visual Studio 2019
npm config set msvs_version=2019 --global

Then retry npm install.

3Update Node.js to a recent version

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

4Use windows-build-tools as an alternative

If you don't want the full Visual Studio IDE:

bash
# Run as Administrator in PowerShell
npm install --global --production windows-build-tools

Or via Chocolatey:

bash
choco install python visualstudio2022-workload-vctools -y

Advanced 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