. Advertisement .
..3..
. Advertisement .
..4..
If you face the error “ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set” when you try to code in Node.js. This article will provide you with details about this error and solutions to solve it.
How Does The Error “ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set” Appear?
According to the error log, the major mistake is caused by neither you have not installed the latest version of Windows-build-tools, Desktop Development with C++, or node-gyp. And you may not set msbuild_path from the command line or npm config. The log appears as follows.
gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set, not running in VS Command Prompt
gyp gypERR! ERR! find VSfind VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! gypfind VS
gyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config npm
ERR! code ELIFECYCLE npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install –fallback-to-build`
npm ERR! Exit status 1
npm ERR! Failed at the [email protected] install script.
Now we will go through four solutions below to find the one that suit you best!
How To Resolve The Error “ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set”?
METHOD 1: Install node-gyp
Node.js Addons are complied by a tool named node-gyp. Node.js Addons are native Node.js Modules written in C or C++ and, as a result, need compilation on your computer. You have to install node-gyp before npm install. To install node-gyp, run the command as follows.
npm install -g node-gyp
And now you can install npm
npm install
Finally, the problem must be solved.
METHOD 2: Set msbuild_path
To solve the error “ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set”, set the path for msbuild_path. You must find the file named MSBuild.exe, which should be located at C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe, and copy its address. Continue, set npm config set msbuild_path with the file path by executing the following snippet.
npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"
METHOD 3: Desktop development with C++
With this method, solving the error may be more entangled. While installing Desktop development with C++, you also have to install Visual Studio. During the installation, please keep in mind to tick mark the Desktop development with C++ as in the picture below.
......... ADVERTISEMENT .........
..8..
......... ADVERTISEMENT .........
..8..
After the installation is finished, your computer will restart.
METHOD 4: Install Windows-build-tools
You can quickly address the error “ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set” by installing Windows-build-tools of Microsoft. To do that, you need to open the Terminal with Administrator Privileges. On your Terminal, run the command below to install Windows-build-tools.
npm install --global windows-build-tools
We hope that you can resolve the error successfully with the four solutions above.
Conclusion
“ERR!ERR! find VSfind VS msvs_version not set from command line or npm config VCINSTALLDIR not set” is absolutely an annoying issue when you code in Node.js. Above are four solutions that we find could fix this problem. If you face any trouble while resolving this error or have questions, leave a comment down below for us. Thank you for reading!
Read more:
→ Unexpected token import SyntaxError in Node.js – How To Fix It?
Leave a comment