Facing problems in installing brain.js [duplicate] - node.js

I want to run this project : https://github.com/adonis-china/adonis-adminify
When I run npm install, there exist error :
> sqlite3#3.1.13 install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.13 and node#10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.13 and node#10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
gyp ERR!ERR! find VSfind VS
msvs_version not set from command line or npm config
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 checking VS2019 (16.2.29230.47) found at:
gypERR! find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
ERR!gyp find VS ERR! "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp ERR!find VS - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
gypERR! ERR!find VS could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR! find VSfind VS looking for Visual Studio 2015
- not found
gyp gyp ERR!ERR! find VSfind VS - not found
not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp gypERR! ERR!find VS
gypfind VS **************************************************************
gypERR! ERR!find VS find VS **************************************************************
You need to install the latest version of Visual Studio
gypgyp ERR! ERR!find VS find VS You need to install the latest version of Visual Studio
including the "Desktop development with C++" workload.
gypgyp ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
For more information consult the documentation at:
gyp ERR!gyp find VS For more information consult the documentation at:
ERR!gyp ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS **************************************************************
find VSgyp **************************************************************
gypERR! find VS
ERR! find VS
gyp gypERR! ERR!configure error
configure errorgyp
ERR! stackgyp Error: Could not find any Visual Studio installation to use
gypERR! stackERR! Error: Could not find any Visual Studio installation to use
stackgyp at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR!gyp stack at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR! gypstack at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gypERR! ERR!stack at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gypgyp ERR! stack at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypERR! ERR! stackstack at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp gypERR! ERR!stack stack at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypgyp ERR!ERR! stackstack at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
gyp ERR! ERR!stack at ChildProcess.exithandler (child_process.js:301:5)
gypstack at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
ERR! gypstack at ChildProcess.emit (events.js:182:13)
gypERR! ERR! stack at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
stack at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR! System Windows_NT 10.0.17134
stackgyp at ChildProcess.exithandler (child_process.js:301:5)
ERR!gyp commandERR! "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
gypstack at ChildProcess.emit (events.js:182:13)
gypERR! ERR!cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gypstack ERR! at maybeClose (internal/child_process.js:962:16)
node -v v10.15.0
gypgyp ERR!ERR! Systemnode-gyp -v Windows_NT 10.0.17134
v5.0.3
gypgyp ERR!ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
not okgyp
ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Chelsea\AppData\Roaming\npm-cache\_logs\2019-09-10T22_53_41_072Z-debug.log
How can I solve the error?

TL;DR
Use the Visual Studio Installer to get the Desktop development with C++ workload in one of the Visual Studio versions you have installed in your machine:
Reason/Details
Reading through the log, the main error is due to this:
msvs_version not set from command line or npm config
After this one you find a few of these:
"Visual Studio C++ core features" missing
And later:
You need to install the latest version of Visual Studio including the "Desktop development with C++" workload.
For more information consult the documentation at:
VS https://github.com/nodejs/node-gyp#on-windows
Finally:
Could not find any Visual Studio installation to use
So to solve the problem, you just need to get "Desktop development with C++" workload.
If you have a Visual Studio version installed
open Visual Studio Installer (Win + search for it)
on the list displayed with all Visual Studio Installations you have in your PC, press the Modify button of one of them (preferably the latest version)
on the Workloads grid/list select the checkbox with Desktop development with C++
Press one of the Install buttons
gyp will then find that version and use it:
gyp info find Python using Python version 3.8.1 found at "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\python.exe"
gyp info find VS using VS2019 (16.4.29709.97) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\
With NO Visual Studio installed
The following solutions assume you have node installed. Disclaimer: I did not test any of them, but I appreciate everyone that reported them solving this issue.
Alternative 0: before installing additional software
As kaulshapranav wrote in a couple of comments, slightly shortened/rephrased:
windows-build-tools installation log mentions this tools package is deprecated and is already included with node. It corrupts my anaconda installation by installing a separate python 2.7 (...); updating npm version from 6 -> 8 solved the issue.
npm comes with node, so the solution: update your node/npm version. However, if you need to retain specific versions, nvm (notice the v) allows to change between them: simple tutorial on how to use nvm.
Alternative 1
As Hamid Jolany's answer suggests, on an admin shell, simply install the build tools package globally (node-gyp README):
npm i -g windows-build-tools
Alternative 2
Ragavan's idea/answer from a similar thread:
verify if you have VS build tools by running npm config get msvs_version (if you have, skip to step 4 and attempt setting the environment variables)
if not installed, get the VS build tools latest version exe and install it (Ragavan's idea was with or Microsoft Build Tools 2015)
run npm config set msvs_version 2019 --global (or npm config set msvs_version 2015 --global according to Ragavan's idea)
Possibly optional: set the VCTargetsPathenvironment variable (Win + search for var) to the appropriate path (e.g. C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0) or through Run as Admin terminal, as in Ragavan's idea with the 2015 Build Tools:
set VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140"
or in Powershell: $env:VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
Side notes:
a previous error might be resolved by installing Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019;
you might also want to restart after installing any of the above

Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
Full Guidance in GitHub

To get this to work with Visual Studio 2022, I had to run:
npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"

Use the following command before npm install:
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
Changing \Enterprise\ to \Community\ worked for me.

I solved the issue with npm install -g node-gyp, then npm install.

Visual Studio Installer -> Modify Installed(Visual Studio Community 2019) -> Workloads(tab) -> [x] Desktop development with C++ -> Install

I finally solved it on my end
here is how I did it
run this command on visual studio: npm config get msvs_version( mine was saying undefined)
then I run npm config set msvs_version 2022 --global(I was not seeing undefined anymore)
Then run: npm install. then I run my automation but this time I was seeing (Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN:)
then I run set NODE_TLS_REJECT_UNAUTHORIZED=0 and voila!!! it is working
I hope this helps .it was really annoying because some of my automation file was not working

Start by running this (you can edit the year and type of VS you have i.e 2022 and community)
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
Afterwards Run npm install -g node-gyp, then npm install.
Make sure all this is done within the project.

Try
npm install --global --production windows-build-tools --vs2015
It worked for me.

I only installed C++ build tools (refer picture) through Visual Studio Build Tools (2019 version). No other steps required for me on Win 10 Pro.

I tried to solve this issue using npm i -g windows-build-tools but not working then I install Visual Studio Build Tools desktop development with c++ tools
and finally successfully solved this issue

Cool!
Following old answers, npm i -g windows-build-tools is an easy and successful answer. But windows-build-tools exists a bug with issue: https://github.com/felixrieseberg/windows-build-tools/issues/244. Try and do it!

just update module gulp-sass to the latest version, add sass module to the package.json and write
const sass = require('gulp-sass')(require('sass'));
to the gulpfile.js to get rid off node-gyp.

i fixed by install vscode 2017 and Desktop development with C++(im install with default optinal select download. not sure if not select default optinal see image.
will error or not) with vsInstaller and set (please set with Developer Command Prompt for VS 2017) use command with your directory project not global example: cd "G:\work\projectA"
set msbuild_path by command:
npm config set msbuild_path "G:\vs 2017\MSBuild\15.0\Bin\MSBuild.exe" (im setup with drive G by initiate because my c drive is full)
set msvs_version by command:
npm config set msvs_version 2017 (before im use 2015 can't work)
im check node-gyp can work? by command
node-gyp configure if not err. congat you can use npm install now
note: you can check local value by npm config get ....

If you are still facing issues with installation of windows build
tool. you can also install it manually without using command prompt.
you can install windows build tools through official site or by this also here.
1: Windows Build Tool Complete Package : Here
2: Official site to download: Here

I got the same issue and was confused about what I should do. I searched the whole web and still no solution.
What I decided to do is that
npm outdated
When you try this command you will see all the versions basically and in detail you understand which version is needed, which is the latest version at that moment, and which version your project json file has.
C:\GitHub\portfolio>npm outdated
Package Current Wanted Latest Location Depended by
babel-plugin-styled-components 1.13.3 1.13.3 2.0.7 node_modules/babel-plugin-styled-components portfolio
babel-preset-gatsby 1.14.0 1.14.0 2.21.0 node_modules/babel-preset-gatsby portfolio
eslint 7.32.0 7.32.0 8.22.0 node_modules/eslint portfolio
gatsby 3.14.6 3.14.6 4.21.1 node_modules/gatsby portfolio
gatsby-plugin-google-analytics 3.14.0 3.14.0 4.21.0 node_modules/gatsby-plugin-google-analytics portfolio
gatsby-plugin-image 1.14.2 1.14.2 2.21.0 node_modules/gatsby-plugin-image portfolio
gatsby-plugin-netlify 2.11.1 2.11.1 5.0.1 node_modules/gatsby-plugin-netlify portfolio
gatsby-plugin-offline 3.10.2 3.10.2 5.21.0 node_modules/gatsby-plugin-offline portfolio
gatsby-plugin-react-helmet 3.10.0 3.10.0 5.21.0 node_modules/gatsby-plugin-react-helmet portfolio
gatsby-plugin-sitemap 2.12.0 2.12.0 5.21.0 node_modules/gatsby-plugin-sitemap portfolio
gatsby-plugin-styled-components 3.10.0 3.10.0 5.21.0 node_modules/gatsby-plugin-styled-components portfolio
gatsby-remark-prismjs 3.13.0 3.13.0 6.21.0 node_modules/gatsby-remark-prismjs portfolio
gatsby-transformer-remark 4.11.0 4.11.0 5.21.0 node_modules/gatsby-transformer-remark portfolio
husky 6.0.0 6.0.0 8.0.1 node_modules/husky portfolio
lint-staged 10.5.4 10.5.4 13.0.3 node_modules/lint-staged portfolio
react 17.0.2 17.0.2 18.2.0 node_modules/react portfolio
react-dom 17.0.2 17.0.2 18.2.0 node_modules/react-dom portfolio
Then after I figure out all reds to yellow, all the packages are installed and ready to use.
Now try it again.
Worked for me; it should work for you too.

If all of above doesn't help, verify that your command prompt is not customized
E.g., if you're using MS Windows and you use doskey to add aliases on startup.
The tools that look for Visual Studio installation get mixed up if this happens.
You can test if this is the case by manually opening a new command prompt and verifying it has bare minimum output, such as
Microsoft Windows ...
(c) ...
$Path>

My solution was combination of all previous fixes:
Install Visual Studio 2017 (https://my.visualstudio.com/Downloads?q=Visual%20Studio%202017 - It will ask you to log in, choose Build Tools for Visual Studio 2017 (version 15.9))
When installing, choose Desktop development with C++ (or similar name)
In C:\Users\<your_username>\ open .npmrc file and delete everything inside, save and close file
Now you need to set environment variables. If you don't know how to do it google it.
3.1 In section user variables click new, set variable name as VCINSTALLDIR and variable value as C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\ (note that path can be different in your case but make sure that VC path is provided).
In terminal do:
4.1 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
(note that location can be different in your case, but make sure you are specifying correct path to MSBuild.exe including MSBuild.exe)
4.2 npm config set msvs_version 2017
Now you can run build or install. When I did all the steps, I didn't get error.

For me worked the trick of using of npm 14.14.0
gyp started to work perfectly well
ps for my project I also installed Visual Studio Build Tools (2022 version) with Desktop development with C++ workload and Python311 with configuring its PATH in win10

Ensure that you have the latest npm installed.
npm install -g npm#latest

I also faced the same issue, what I did is I reinstall the nodejs

Related

How to force npm to use different node-gyp version when installing packages?

I am running Node 16.13.2 LTS with Visual Studio 2022. During the installation of a package, node-gyp is triggered and fails.
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node build.js || nodejs build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.3.0
npm ERR! gyp info using node#16.13.2 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.4 found at "C:\Users\ahboy\AppData\Local\Programs\Python\Python39\python.exe"
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! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Professional"
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
I went to do some research and found out that node-gyp#8.3.0 does not support VS 2022. Only version node-gyp#8.4 does. So I started to try to get npm to use node-gyp#8.4.0 but nothing works including this advice from node-gyp github page to install node-gyp globally and point the path in npmrc file.
So what can be done to force npm to use different node-gyp versions when installing packages?
I had a similar issue, what solved it for me was using nvm: Node Version Manager to install Node version 14, alongside the latest one. The repository I was cloning had a lot of dependencies. Also, I did not need to be on the bleeding edge of progress with the latest Node version.
Here is further resource on how to install and use nvm: Installing nvm on Windows.
If you installed latest node-gyp.
Check the version of node-gyp both in terminal (Powershell) and vscode terminal. One of them should be pointing to the 8.4 and another one to 8.3 So the terminal that you are running the app, looks like is not recognizing the path of 8.4 version.
What does the package.json in the package your installing show for the node-gyp dependency version? Also look at all subdependencies of those dependencies to see if any of those reference version 8.3. I've ran into this same issue as well on windows. If you can't get your version to update, you can also install visual studio build tools 2017 and set your msvs_version to 2017 and it should pick that up for you. No need to install the full vs2017, just the build tools will do fine.
Declare your dependency on the newer version of node-gyp in your package.json file. Add this to your dependency block:
"node-gyp" : "^8.4.1",
I did exactly this about an hour ago to get our github actions CI tests working since the switch of 'windows-latest' became windows server 2022.

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
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.
Solved node-gyp in Windows 11, VSCode, Visual Studio 2022
node -v
v18.4.0
nvm version
1.1.9
node-gyp -v
v9.0.0
node-gyp configure --msvs_version=2022
Start Visual Studio Installer
Beside Visual Studio Community 2022 -> Modify ->Individual Components
Type Visual C++
Make sure MSVC v143 ... x64/x86 build tools (Latest) is checked.
Check current Windows version
Back to Visual Studio install, type SDK, and find the correct SDK version.
for me, Windows 11 SDK (10.0.22000.0)
After all those setup..
I still get
gyp ERR! find VS - does not match this Visual Studio Command Prompt
knowing that I have to hack the code
adding this 3 lines above the error log
+this.addLog("this.envVcInstallDir: " + this.envVcInstallDir)
+this.addLog("vsPath: " + vsPath)
+this.addLog("path.relative(this.envVcInstallDir, vsPath): " + path.relative(this.envVcInstallDir, vsPath))
if (this.envVcInstallDir &&
path.relative(this.envVcInstallDir, vsPath) !== '') {
this.addLog('- does not match this Visual Studio Command Prompt')
return false
}
and tracing into
if (process.env.VCINSTALLDIR) {
this.envVcInstallDir =
path.resolve(process.env.VCINSTALLDIR, '..')
this.addLog('running in VS Command Prompt, installation path is:\n' +
`"${this.envVcInstallDir}"\n- will only use this version`)
} else {
this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt')
}
Finally, have to add something at the end of VCINSTALLDIR
Problem solved, will uninstall VS 2017 & 2019 to save space.
Not sure which one (or combination) of the steps that i took solved the issue, but they were:
Updated to latest node.js version (v18.12.1 as of writing this) and ran chocolatey ("install additional packages" checkbox) through the installer, it updated python to 3.11.
Removed all visual studio build installs, except for 2017.
Ran command npm config set msvs_version=2017.
Restarted my machine.
Ran the nodejs repair option of the installer.
And that's it!
For context, I was updating an Angular project 14 -> 15 and started running into these issues.
Along the way I've also installed Visual Studio 2022 Community with the Development with c++ workload, but node-gyp was still not recognizing it.
Also had Visual Studio Build Tools 2019 that i've uninstalled.
The 2017 version I'm running is 15.9.43.
Hope this helps someone in the future :)
I solved by the below steps:
After installed the Visual Studio 2019 Community with the Development with C++
I still see the error msvs_version does not match this version on my npm install log
So I run npm config get msvs_version to check the current msvs_version
Then I set it to match with my install Visual Studio version
npm config set msvs_version 2019 --global
Image of Got Error
Image of Fixed the issue

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

I want to run this project : https://github.com/adonis-china/adonis-adminify
When I run npm install, there exist error :
> sqlite3#3.1.13 install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.13 and node#10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.13 and node#10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
gyp ERR!ERR! find VSfind VS
msvs_version not set from command line or npm config
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 checking VS2019 (16.2.29230.47) found at:
gypERR! find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
ERR!gyp find VS ERR! "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp ERR!find VS - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
gypERR! ERR!find VS could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR! find VSfind VS looking for Visual Studio 2015
- not found
gyp gyp ERR!ERR! find VSfind VS - not found
not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp gypERR! ERR!find VS
gypfind VS **************************************************************
gypERR! ERR!find VS find VS **************************************************************
You need to install the latest version of Visual Studio
gypgyp ERR! ERR!find VS find VS You need to install the latest version of Visual Studio
including the "Desktop development with C++" workload.
gypgyp ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
For more information consult the documentation at:
gyp ERR!gyp find VS For more information consult the documentation at:
ERR!gyp ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS **************************************************************
find VSgyp **************************************************************
gypERR! find VS
ERR! find VS
gyp gypERR! ERR!configure error
configure errorgyp
ERR! stackgyp Error: Could not find any Visual Studio installation to use
gypERR! stackERR! Error: Could not find any Visual Studio installation to use
stackgyp at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR!gyp stack at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR! gypstack at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gypERR! ERR!stack at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gypgyp ERR! stack at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypERR! ERR! stackstack at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp gypERR! ERR!stack stack at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypgyp ERR!ERR! stackstack at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
gyp ERR! ERR!stack at ChildProcess.exithandler (child_process.js:301:5)
gypstack at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
ERR! gypstack at ChildProcess.emit (events.js:182:13)
gypERR! ERR! stack at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
stack at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR! System Windows_NT 10.0.17134
stackgyp at ChildProcess.exithandler (child_process.js:301:5)
ERR!gyp commandERR! "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
gypstack at ChildProcess.emit (events.js:182:13)
gypERR! ERR!cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gypstack ERR! at maybeClose (internal/child_process.js:962:16)
node -v v10.15.0
gypgyp ERR!ERR! Systemnode-gyp -v Windows_NT 10.0.17134
v5.0.3
gypgyp ERR!ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
not okgyp
ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Chelsea\AppData\Roaming\npm-cache\_logs\2019-09-10T22_53_41_072Z-debug.log
How can I solve the error?
TL;DR
Use the Visual Studio Installer to get the Desktop development with C++ workload in one of the Visual Studio versions you have installed in your machine:
Reason/Details
Reading through the log, the main error is due to this:
msvs_version not set from command line or npm config
After this one you find a few of these:
"Visual Studio C++ core features" missing
And later:
You need to install the latest version of Visual Studio including the "Desktop development with C++" workload.
For more information consult the documentation at:
VS https://github.com/nodejs/node-gyp#on-windows
Finally:
Could not find any Visual Studio installation to use
So to solve the problem, you just need to get "Desktop development with C++" workload.
If you have a Visual Studio version installed
open Visual Studio Installer (Win + search for it)
on the list displayed with all Visual Studio Installations you have in your PC, press the Modify button of one of them (preferably the latest version)
on the Workloads grid/list select the checkbox with Desktop development with C++
Press one of the Install buttons
gyp will then find that version and use it:
gyp info find Python using Python version 3.8.1 found at "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\python.exe"
gyp info find VS using VS2019 (16.4.29709.97) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\
With NO Visual Studio installed
The following solutions assume you have node installed. Disclaimer: I did not test any of them, but I appreciate everyone that reported them solving this issue.
Alternative 0: before installing additional software
As kaulshapranav wrote in a couple of comments, slightly shortened/rephrased:
windows-build-tools installation log mentions this tools package is deprecated and is already included with node. It corrupts my anaconda installation by installing a separate python 2.7 (...); updating npm version from 6 -> 8 solved the issue.
npm comes with node, so the solution: update your node/npm version. However, if you need to retain specific versions, nvm (notice the v) allows to change between them: simple tutorial on how to use nvm.
Alternative 1
As Hamid Jolany's answer suggests, on an admin shell, simply install the build tools package globally (node-gyp README):
npm i -g windows-build-tools
Alternative 2
Ragavan's idea/answer from a similar thread:
verify if you have VS build tools by running npm config get msvs_version (if you have, skip to step 4 and attempt setting the environment variables)
if not installed, get the VS build tools latest version exe and install it (Ragavan's idea was with or Microsoft Build Tools 2015)
run npm config set msvs_version 2019 --global (or npm config set msvs_version 2015 --global according to Ragavan's idea)
Possibly optional: set the VCTargetsPathenvironment variable (Win + search for var) to the appropriate path (e.g. C:\Program Files (x86)\MSBuild\Microsoft\Portable\v5.0) or through Run as Admin terminal, as in Ragavan's idea with the 2015 Build Tools:
set VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140"
or in Powershell: $env:VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
Side notes:
a previous error might be resolved by installing Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019;
you might also want to restart after installing any of the above
Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
Full Guidance in GitHub
To get this to work with Visual Studio 2022, I had to run:
npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"
Use the following command before npm install:
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
Changing \Enterprise\ to \Community\ worked for me.
I solved the issue with npm install -g node-gyp, then npm install.
Visual Studio Installer -> Modify Installed(Visual Studio Community 2019) -> Workloads(tab) -> [x] Desktop development with C++ -> Install
I finally solved it on my end
here is how I did it
run this command on visual studio: npm config get msvs_version( mine was saying undefined)
then I run npm config set msvs_version 2022 --global(I was not seeing undefined anymore)
Then run: npm install. then I run my automation but this time I was seeing (Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN:)
then I run set NODE_TLS_REJECT_UNAUTHORIZED=0 and voila!!! it is working
I hope this helps .it was really annoying because some of my automation file was not working
Start by running this (you can edit the year and type of VS you have i.e 2022 and community)
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
Afterwards Run npm install -g node-gyp, then npm install.
Make sure all this is done within the project.
Try
npm install --global --production windows-build-tools --vs2015
It worked for me.
I only installed C++ build tools (refer picture) through Visual Studio Build Tools (2019 version). No other steps required for me on Win 10 Pro.
I tried to solve this issue using npm i -g windows-build-tools but not working then I install Visual Studio Build Tools desktop development with c++ tools
and finally successfully solved this issue
Cool!
Following old answers, npm i -g windows-build-tools is an easy and successful answer. But windows-build-tools exists a bug with issue: https://github.com/felixrieseberg/windows-build-tools/issues/244. Try and do it!
just update module gulp-sass to the latest version, add sass module to the package.json and write
const sass = require('gulp-sass')(require('sass'));
to the gulpfile.js to get rid off node-gyp.
i fixed by install vscode 2017 and Desktop development with C++(im install with default optinal select download. not sure if not select default optinal see image.
will error or not) with vsInstaller and set (please set with Developer Command Prompt for VS 2017) use command with your directory project not global example: cd "G:\work\projectA"
set msbuild_path by command:
npm config set msbuild_path "G:\vs 2017\MSBuild\15.0\Bin\MSBuild.exe" (im setup with drive G by initiate because my c drive is full)
set msvs_version by command:
npm config set msvs_version 2017 (before im use 2015 can't work)
im check node-gyp can work? by command
node-gyp configure if not err. congat you can use npm install now
note: you can check local value by npm config get ....
If you are still facing issues with installation of windows build
tool. you can also install it manually without using command prompt.
you can install windows build tools through official site or by this also here.
1: Windows Build Tool Complete Package : Here
2: Official site to download: Here
I got the same issue and was confused about what I should do. I searched the whole web and still no solution.
What I decided to do is that
npm outdated
When you try this command you will see all the versions basically and in detail you understand which version is needed, which is the latest version at that moment, and which version your project json file has.
C:\GitHub\portfolio>npm outdated
Package Current Wanted Latest Location Depended by
babel-plugin-styled-components 1.13.3 1.13.3 2.0.7 node_modules/babel-plugin-styled-components portfolio
babel-preset-gatsby 1.14.0 1.14.0 2.21.0 node_modules/babel-preset-gatsby portfolio
eslint 7.32.0 7.32.0 8.22.0 node_modules/eslint portfolio
gatsby 3.14.6 3.14.6 4.21.1 node_modules/gatsby portfolio
gatsby-plugin-google-analytics 3.14.0 3.14.0 4.21.0 node_modules/gatsby-plugin-google-analytics portfolio
gatsby-plugin-image 1.14.2 1.14.2 2.21.0 node_modules/gatsby-plugin-image portfolio
gatsby-plugin-netlify 2.11.1 2.11.1 5.0.1 node_modules/gatsby-plugin-netlify portfolio
gatsby-plugin-offline 3.10.2 3.10.2 5.21.0 node_modules/gatsby-plugin-offline portfolio
gatsby-plugin-react-helmet 3.10.0 3.10.0 5.21.0 node_modules/gatsby-plugin-react-helmet portfolio
gatsby-plugin-sitemap 2.12.0 2.12.0 5.21.0 node_modules/gatsby-plugin-sitemap portfolio
gatsby-plugin-styled-components 3.10.0 3.10.0 5.21.0 node_modules/gatsby-plugin-styled-components portfolio
gatsby-remark-prismjs 3.13.0 3.13.0 6.21.0 node_modules/gatsby-remark-prismjs portfolio
gatsby-transformer-remark 4.11.0 4.11.0 5.21.0 node_modules/gatsby-transformer-remark portfolio
husky 6.0.0 6.0.0 8.0.1 node_modules/husky portfolio
lint-staged 10.5.4 10.5.4 13.0.3 node_modules/lint-staged portfolio
react 17.0.2 17.0.2 18.2.0 node_modules/react portfolio
react-dom 17.0.2 17.0.2 18.2.0 node_modules/react-dom portfolio
Then after I figure out all reds to yellow, all the packages are installed and ready to use.
Now try it again.
Worked for me; it should work for you too.
If all of above doesn't help, verify that your command prompt is not customized
E.g., if you're using MS Windows and you use doskey to add aliases on startup.
The tools that look for Visual Studio installation get mixed up if this happens.
You can test if this is the case by manually opening a new command prompt and verifying it has bare minimum output, such as
Microsoft Windows ...
(c) ...
$Path>
My solution was combination of all previous fixes:
Install Visual Studio 2017 (https://my.visualstudio.com/Downloads?q=Visual%20Studio%202017 - It will ask you to log in, choose Build Tools for Visual Studio 2017 (version 15.9))
When installing, choose Desktop development with C++ (or similar name)
In C:\Users\<your_username>\ open .npmrc file and delete everything inside, save and close file
Now you need to set environment variables. If you don't know how to do it google it.
3.1 In section user variables click new, set variable name as VCINSTALLDIR and variable value as C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\ (note that path can be different in your case but make sure that VC path is provided).
In terminal do:
4.1 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
(note that location can be different in your case, but make sure you are specifying correct path to MSBuild.exe including MSBuild.exe)
4.2 npm config set msvs_version 2017
Now you can run build or install. When I did all the steps, I didn't get error.
For me worked the trick of using of npm 14.14.0
gyp started to work perfectly well
ps for my project I also installed Visual Studio Build Tools (2022 version) with Desktop development with C++ workload and Python311 with configuring its PATH in win10
Ensure that you have the latest npm installed.
npm install -g npm#latest
I also faced the same issue, what I did is I reinstall the nodejs

node-gyp configure got "gyp ERR! find VS"

I am trying to start about node c/c++ add-on. the node-gyp command got error
I have installed vs2019, my command is
node-gyp configure --msvs_version=2019
the verbose output is
gyp info it worked if it ends with ok
gyp info using node-gyp#5.0.3
gyp info using node#10.16.0 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\seact\.windows-build-tools\python27\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2019
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp ERR! find VS - could not find MSBuild in registry for this version
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at findVisualStudio2013 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp ERR! stack at findVisualStudio2015 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gyp ERR! stack at regSearchKeys (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:377:20)
gyp ERR! stack at regGetValue (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\util.js:54:7)
gyp ERR! stack at D:\Program Files\node-win-x64\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:301:5)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "D:\\Program Files\\node-win-x64\\node.exe" "D:\\Program Files\\node-win-x64\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--msvs_version=2019"
gyp ERR! cwd D:\Projects\learn_node_ext
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
You do not have to install Visual Studio, just install the windows build tools:
run CMD as Admin
run npm install --g --production windows-build-tools
This should fix that.
There are 2 aspects to this error. Now in 2022, if you have installed Visual Studio 2022, even after installing Desktop development with C++ or the build tools it still wont work.
Few things you need to do even after installation.
npm config get python should be set to Python 3.x
--> npm config set python C:\Python310\python.exe
npm config get msvs_version should be using 2022
--> npm config set msvs_version 2022 --global
Additionally you can set
npm config set msbuild_path "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"
your VCINSTALLDIR ENV variable should be set to C:\Program Files\Microsoft Visual Studio\2022\Community\VC
In some case it still wont work, then you can follow the additional steps, visit the folder of your Node.js exe installation, should be same even for an nvm node version; https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md
cd "C:\Program Files\nodejs"
cd node_modules\npm\node_modules\#npmcli\run-script
npm install node-gyp#latest
Open your Visual Studio & then in 'search box' search VS 2019 C++ x64/x86 build tools and install then search Desktop development with C++ install it. Hope this helps.
If you are using Chocolatey, install the following:
choco install visualstudio2019buildtools visualstudio2019-workload-vctools
It is because the C++ build tools are not installed. It can be solved by installing VS 2019 C++ x64/x86 build tools in Visual Studio installer:
Your powershell is running probably in constrained mode.
See this thread: how to change PowerShell mode to fulllanguage mode from constrained mode?
Downloading the latest Visual Studio build Tools
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
and running the following command in the 'Program Files (x86)\Microsoft Visual Studio\2017\BuildTools' Directory
npm install --g --production windows-build-tools
and Installing node-gyp in the current directory
npm install node-gyp
Worked For me on Windows 10
for more, please visite the official node-gyp installation guide
I had to set python path for npm even though I had python on my PATH.
npm config set python /path/to/executable/python
then try npm install again
It should be a npm package bug of windows-build-tools.
Step 1: Be sure you installed Visual Studio Code
Step 2: Search %temp% under window search bar (Copy %temp% then press windows button + Ctrl V)
Step 3: Create 'dd_client_.log.txt' and enter 'Closing installer. Return code: 3010.'
Now you should be able to finish the whole process with npm install --global windows-build-tools
My working environment: Visual Studio Enterprise 2022, Python 3.11, and Node v18.13.0. I did everything according to steel's answer, but still got errors. Looks like npm config set msvs_version 2022 --global doesn't help.
I finally got it working by adding an Environment Variable - GYP_MSVS_VERSION and setting it to 2022.
Download Visual Studio Community Edition
Run the executable
Choose the options as below.
and it should solve the issue.
In case if someone still has the visual studio installation required error after going through all the steps mentioned above. I had this issue when I was trying to run an electron application. The solution for my issue was simply adding the visual studio to the environment variables after going through all the above steps.
To set the path run the following command on cmd (if possible as admin):
setx VCTargetsPath “C:\Program Files (x86)\MSBuild\15.0"
Note: the path for my visual studio was as in the above. you may have to change it according to your installation.
The software versions I was using are as follows:
nodejs : 14.17.0
OS : windows10 64-bit
Python : 2.7.15 (installed default with node js)
Visual studio : community edition 2019
some of the other things to check is to make sure the python version, msvs_version are set to the correct versions in the npm config.
Instead of running 'npm install', run 'npm update' directly in the folder. This solved my issue.
Same issue after upgrading to latest node LTS version. This did the trick for me:
removed node_modules folder
removed package-lock.json file
npm install
TLDR: Installing the latest LTS version of Node.js via Windows Installer worked for me somehow. Latest LTS Version
I tried all the answers from this thread and some other articles as well but nothing was working for me. After spending 6+ hours on this issue, I saw this note on Windows-Build-Tools Github page.
Please note that the official Node.js for Windows installer can now automatically install the required tools. That's likely a much better option than the module listed here (windows-build-tools).
So I installed the latest LTS version of Node.js via Windows Installer from Node js website as shown in the above image and it worked somehow.
Solution that worked for me was to install latest Visual Studio Build Tools and then execute following command, taken from node-gyp installation instructions here:
npm config set msvs_version 2017
npm install --g --production windows-build-tools
on my computer works with the next commands
npm install --g --production windows-build-tools
npm install node-gyp
npm audit fix
npm install node-phpass
Same issue faced by me with VS 2022 community edition, node 15.x, python 3.10
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! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
Issue was due to non-compatible Node version 15.x.x to gyp
and, successfully resolved with downgrading node to 14.17.3 version.
Thanks
I had the same problem before, thanks C. Szabo's answer.
node-gyp use Powershell script to find Visual Studio. You should check
$ExecutionContext.SessionState.LanguageMode
in Powershell. If it return 'ConstrainedLanguage', node-gyp will fail to find Visual Studio. Change _PSLockdownPolicy in register can fix this problem, see this answer. (Don't forget to reboot Windows)
I also encountered this error. After trying all the suggestions I could find and spending 2 days trying to resolve it, I finally found out the reason it wasn't working for me was that in my build environment I didn't have ProgramData env variable defined. After adding "ProgramData": "C:\ProgramData" everything started working like a charm.
When this env var is not defined, for whatever reason, query2.EnumAllInstances() in Find-VisualStudio.cs returns empty enumeration.
Hopefully this will be useful for someone as well.
My friend creates the project and her node/npm versions are not compatible with mine.
So I try to upgrade my npm versions only. It's solved the problem.
But some of the dependencies are not working. So I update the node versions, as along with the npm version, will update. It solved almost all problems and errors.
You should find the correct compatible version of node and npm. Here you can find the node version and compatible npm version.
Make sure to check your npm version and node versions are compatible.

error TRK0005: Failed to locate: "CL.exe"

I'm using Windows 8.1. I installed Visual Studio 2015 community edition. When I run npm install -g generator-keystone, I get the error at the bottom. I tried running the following commands, but I'm still getting the same results.
set GYP_MSVS_VERSION=2015
npm config set msvs_version 2015 --global
C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools>if not defined npm_config_no
de_gyp (node "C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node
-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. [C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools\build\buffertool
s.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\user\AppData
\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools\build\buffertools.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib
\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm
\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:buffertools#2.1.3 buffertools#2.1.3 install: `node-gyp rebuild`
npm WARN install:buffertools#2.1.3 Exit status 1
C:\Users\user\AppData\Roaming\npm
├── generator-keystone#0.3.9
└── UNMET PEER DEPENDENCY yo#>=1.0.0
I went into Visual Studio and created a Visual C++ project, which installed several libraries. npm install worked after that.
I went to \Users\[my-user]\.windows-build-tools - an install file for VS Build-tools was there (for 2017 it's vs_BuildTools.exe), I ran and installed it.
After that I ran npm install --global --production windows-build-tools
("Option 1" from here).
Then it worked.
If your project is very old, try a different platform. In one case I changed Project -> Properties -> Platform Toolset from Windows XP to a newer platform, then picked Rebuild Solution.
Somehow cl.exe was missing from my C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64 folder. I had to delete and reinstall buildtools using the installer.
Since I don't have 50 reputation I can't comment to a couple of the questions on here.
The bin folder that one of the posters is referring to is "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" this could be different for other users based on what version of Visual Studio you have installed on your system. Guessing that they are just putting msbuild on the PATH without more information.
Another poster put that they changed 140 to 142 and it worked. They are talking about the "PlatformToolset" version in the vcxproj file. The reason this fix worked for them is that they have Visual Studio 2019 and the vcxproj file was set up to build on Visual Studio 2015. If they are working with other people and push their project the next person to pull it could have the same issue if they are using a different version of Visual Studio than 2019.
I use visual basic 2019 latest version. Couldn't run a project with toolset 140. Insted it pops the message TRK0005: Failed to locate: CL.exe. I change it to 142 and it works.
For me this problem was solved after including bin folder in the windows environment variable

Resources