Search code examples
node.jsnode-gyp

node-gyp error Could not find any Visual Studio installation to use


The problem that I am having is that I cant install the packages for a project, it keeps erroring with:

npm ERR! npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! npm ERR! gyp ERR! find VS
npm ERR! npm ERR! gyp ERR! find VS **************************************************************
npm ERR! npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! npm ERR! gyp ERR! find VS **************************************************************

I have tried to follow advice from these threads that other people had:

How to fix node.js error like "gyp ERR! find VS including the "Desktop development with C++" workload." when I launch Nuxt.js project

And this How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config?

But neither seemed to help.

What I have done so far:

  • I installed the latest VS Code (2022 Community) with Desktop development with C++ along with MSVC v143 - VS 2022 C++ x64/x86 build tools

  • I have configured msvs_version to have the value of 2022, I did that with npm config set msvs_version=2022 and with node-gyp configure --msvs_version=2022

  • I have tried installing windows build tools npm install --global --production windows-build-tools but it just says that ...Node.js now incldues build tools for Windows...

  • I have also manually built the node-gyp using the commands found in the second post I listed above node-gyp configure node-gyp configure --msvs_version=2022 node-gyp build and its all greens and oks

And I have no idea what else I can do


Solution

  • I found the problem after hours of searching, it was my node version, i was at 16.x.x, I installed node version manager and moved to version 14 and it worked.