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

32

155

I want to run this project : https://github.com/adonis-china/adonis-adminify

When I run npm install, there exist error :

> [email protected] 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 [email protected] and [email protected] (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 [email protected] and [email protected] (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: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

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!
npm ERR! Failed at the [email protected] 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?

Viperine answered 10/9, 2019 at 22:59 Comment(3)
At first, I would run Visual Studio Installer and add "Visual Studio C++ core features", because it says it wants it and it is missing in your VS2019 installation.Boost
windows-build-tools is corrupting my anaconda installation by installing a separate python 2.7. For my problem, updating npm version from 6 -> 8, resolved the issue without asking for any python at all. So, I would suggest updating npm before installing windows-build-toolsExpectant
An obsolete node-sass version was the cause for me, fixed using an answer in npm install with error: gyp failed with exit code: 1Knob
D
187

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:

VS workloads

2024 update: also "check the Windows 10 SDK in the installation details" (thanks Nicholas)

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

  1. open Visual Studio Installer (Win + search for it)
  2. 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)
  3. on the Workloads grid/list select the checkbox with Desktop development with C++ (2024 update: also "check the Windows 10 SDK in the installation details" (thanks Nicholas))
  4. 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:

  1. 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)
  2. if not installed, get the VS build tools latest version exe and install it (Ragavan's idea was with or Microsoft Build Tools 2015)
  3. run npm config set msvs_version 2019 --global (or npm config set msvs_version 2015 --global according to Ragavan's idea)
  4. 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:

Digital answered 23/1, 2020 at 16:12 Comment(12)
With the 2019 version, I found this error: ValueError: invalid mode: 'rU' while trying to load binding.gyp.Picrotoxin
I think node-gyp still requires python2.Picrotoxin
It is 7.5 GB disk space to install the visual c++ stuffDevinne
choco install nodejs-lts python2 visualstudio2017buildtools visualstudio2017-workload-vctools -y I believe I was able to fix this exact issue with this choco command.Hairsplitter
npm config set msvs_version "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" was required for me on top of the answer, but definitely worked. Thank you!Cumulate
C++ workload, Total space required 6.66 GB, if that isn't a bad sign, i don't know what isPretext
Alternative 1 seems simple but pollutes python spaces (I have anaconda installed with 3.9 and windows-build-tools installs python 2.7). Also when we do npm i -g windows-build-tools, the first line it shows on the console is that that package is deprecated and the build tools are already included with node.Expectant
windows-build-tools is corrupting my anaconda installation by installing a separate python 2.7. For my problem, updating npm version from 6 -> 8, resolved the issue without asking for any python at all. So, I would suggest updating npm before installing windows-build-toolsExpectant
I had only Visual Studio 2022 with "Desktop Development with C++" installed and had this issue. I had to install "Build Tools for Visual Studio 2019" from my.visualstudio.com/… which fixed it.Bijugate
don't forget to restart terminal after install the "Desktop Development with C++"Ryle
I aslo had to check the Windows 10 SDK in the installation details, it was not working with Windows 10 SDKAglaia
Adding the C++ Desktop workload in VS 2022 doesn't solve the problem: still keeps complaining about missing Microsoft.VisualStudio.VC.MSBuild.BaseGraubert
P
26

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

Phuongphycology answered 8/9, 2020 at 13:57 Comment(6)
can you check afterwards which version it effectively installed ?Donata
This tool (windows-build-tools) is now deprecated, node should do this for you now.Oira
@Oira Node still doesn't do it well at all, it's not being detected at allAchromatism
@Achromatism perhaps create a new question and refer to it here? Include any set-up you may use. This is now working for me. To continue to use the windows-build-tools, isn't advised: npmjs.com/package/windows-build-toolsOira
@Oira I ended up making it work. My problem was Node/Python left junk behind even after uninstall and that was messing up the process. These days Node includes all that you need if you pick the "Install additional tools" option in the installer. However, your system has to be squeaky clean before you attempt to do that. That means completely deleting all instances of Node, Python and manually deleting garbage left over such as dirs and env variables (including in the path). Disable your firewall and then run the install. It should download and install everything and work after a reboot.Achromatism
@Achromatism Good tips and that makes sense, my system was a new VM, so no old installs etc. Well done on fixing.Oira
P
19

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"
Perry answered 8/11, 2021 at 22:49 Comment(4)
I installed Desktop Development with C++ workload and I tried this but still I get the same error. Do I need to install windows build tools?Anhwei
No, well at least I didn't have to do that, another thing I did to fix this error when it appeared again on an older project was downgrading node.js to version 14.16.1Perry
In my case it worked after downgrading node.js to v16.13.0Anhwei
In my case it was the other way around - on upgrading from v16.17.0 to v18.17.0 (the latest at the time of writing this), this issue was resolvedDeadline
I
11

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

Implead answered 15/2, 2022 at 9:15 Comment(2)
It did the trick for me. Apparently, the node-gyp version upgrade helped.Bevel
Couldn't set the msvs_versions, this is the only thing that helpedVarnish
P
10

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.

Pinnati answered 23/1, 2021 at 3:18 Comment(2)
The path for me was C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exeActinomorphic
for me it was "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"Obstetric
W
9

I finally solved it on my end here is how I did it

  1. run this command on visual studio: npm config get msvs_version( mine was saying undefined)
  2. then I run npm config set msvs_version 2022 --global(I was not seeing undefined anymore)
  3. Then run: npm install. then I run my automation but this time I was seeing (Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN:)
  4. 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

Warenne answered 11/2, 2022 at 21:53 Comment(2)
I am getting "msvs_version` is not a valid npm option" when trying to do this.Hyponitrite
@Hyponitrite I had the same error. Just run npm config edit and add all your key values pair (msvs_version=2022 or msbuild_path=...)Indefinite
T
8

I wanted to give a recent update. After dealing with this problem for some time, it has become pretty clear to me that some versions of node (currently using 14.19.1) are not able to properly detect build tools for Visual Studio 2022. However, they have no problem detecting build tools for Visual Studio 2019. I was able to get everything working by having Visual Studio 2019 installed alongside Visual Studio 2022. First, you have to undo all the fixing you've been trying to do:

npm config delete msvs_version
npm config delete msvs_version --global
npm config delete msbuild_path
npm config delete msbuild_path --global

Then, download Visual Studio 2019 Community, and during install you must select "Desktop development with C++". At this point, when running npm install, node-gyp will still find your Visual Studio 2022 installation directory and attempt to use it (even if you set msvs_version to 2019), so you must add VCINSTALLDIR into your User environment variables (Start, System Properties, Environment Variables) using this directory:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC

After this, run "refreshenv" at the command prompt, then run npm install, and feel refreshed that the suffering is over. These kind of problems are very unfortunate for us programmers. Hope this works for you.

Topper answered 10/3, 2023 at 17:4 Comment(2)
Thank you so much. I had tried all the suggestions I could find on internet, but only this one works for me.Macarthur
This is the most current and working answer for 2023-12-08Grazynagreabe
C
7

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

Corey answered 5/5, 2020 at 13:18 Comment(0)
M
3

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.enter image description here

Myramyrah answered 2/3, 2022 at 20:2 Comment(0)
V
3

Try

npm install --global --production windows-build-tools --vs2015

It worked for me.

Vaduz answered 9/6, 2022 at 18:48 Comment(0)
A
3

A nice alternative it is to reinstall nodejs add ensure that the checkbox in "Tools for Native modules" step it is CHECKED. This is very important because it will install all the things needed to run apps in this kind of scenarios. I have face the same issue and this solve it.

nodejs "Tools step"

After the nodejs installation will start the installation the other tools in power shell, in my case in a few moments the process stops but restart with only pression enter. After a few minutes all was done

Arthurarthurian answered 29/6, 2023 at 20:2 Comment(0)
K
2

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

enter image description here

Kinesiology answered 21/11, 2021 at 2:48 Comment(0)
U
1

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.

enter image description here

Undercoating answered 21/5, 2021 at 21:21 Comment(0)
D
1

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.

Dulcie answered 24/8, 2022 at 20:26 Comment(0)
F
1

My solution was combination of all previous fixes:

  1. 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)

  2. In C:\Users\<your_username>\ open .npmrc file and delete everything inside, save and close file

  3. 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).

  4. 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

  5. Now you can run build or install. When I did all the steps, I didn't get error.

Falco answered 11/12, 2022 at 19:23 Comment(1)
for step 1 just npm config editIndefinite
S
0

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!

Sp answered 2/9, 2021 at 9:30 Comment(0)
E
0

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.

Expellee answered 2/2, 2022 at 16:45 Comment(0)
B
0

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"

  1. 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)
  2. set msvs_version by command: npm config set msvs_version 2017 (before im use 2015 can't work)
  3. 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 ....

Baxley answered 26/7, 2022 at 12:21 Comment(0)
C
0

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>

Chrysalid answered 12/9, 2022 at 20:21 Comment(0)
E
0

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

Epicycloid answered 20/1, 2023 at 12:37 Comment(0)
F
0

I had got this issue after deciding to re-install node.js (update to latest version). I'm on Windows 11 and was installing node.js 18.16.1 (LTS). There is a checkbox that needs to be selected, to install the additional tools, which I've done. This in turns runs a PowerShell script that will install all that is required. For myself the script finished rally quickly, saying that nothing was done -- I thought that I must have all that's needed since I had Node installed previously. The problem actually was that it was using chocolatey to install it, and as it was already present under: C:\ProgramData\chocolatey it was skipping the whole thing.

You need to remove the entire folder - C:\ProgramData\chocolatey and run the node.js installer once more. Then the script will take quite a long time and might seem to be stuck (you can monitor the resource manager -- either CPU, disk or WiFi will be busy)

I have also had some config in the .npmrc file, which I've added as suggested by some answers on here. You can run npm config edit and remove those values -- for myself the file was all commented out then.

Additionally you need to have Python 3.10 on the Path -- it (currently) doesn't work with 3.11 (however this was giving a different error at later stage).

Foredo answered 3/7, 2023 at 21:52 Comment(0)
R
0

I had the same problem and spent hours trying to fix this. For me, the problem was the version of node used. The node I used had an internal version of node-gyp that was very old (version 5.1.0) and is NOT compatible with Visual Studio 2022. There are two ways to resolve this:

  1. Use a more advanced version of node (I tried node 16.0.0 and above and they all worked for me). Versions 14.17.5 and below didn't work for me.
  2. If you can't upgrade your version of node due to dependency issues, then updating your node-gyp globally won't work and you must update it internally within the location where you node version is installed. It is not complicated. Follow the instructions here: https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md Note: Using the instructions in this link - I tried installing the latest version of node-gyp and it caused new problems. So I tried using node-gyp version 9.0.0 and that worked for me.
Runstadler answered 16/8, 2023 at 6:52 Comment(0)
E
0

In my case it will be difficult to resolve because installing programs on my work machine involves authorization from managers.

I discovered that a lib that my project used was causing a conflict, lib 'node-rfc', I simply went back to an older version and the error stopped occurring.

I returned from 3.3.0 to 2.7.0.

and it worked

Eulalia answered 23/10, 2023 at 16:12 Comment(0)
M
0

I have had that problem with [email protected] on Windows 10 with Visual Studio 2022.

I think v7.1.2 might be not able to work with Visual Studio 2019/2022 properly.

Just try this: find a module in dependencies which uses [email protected] - for me it was gl, for you seems like sqlite3

and add an override below into the main package.json

"overrides": {
    "sqlite3": {
        "node-gyp": "9.3.1"
    }
}

remove node_modules and try npm install again. Hope it helps.

Marbling answered 28/11, 2023 at 10:18 Comment(0)
G
0

I updated the component version and ran it successfully, reducing the version of the component. Python 2.7. Nodejs16.20.0. Visual Studio 2019. The original version was Python 3.10.9 Nodejs18.19. Visual Studio 2022

Gotthelf answered 16/1 at 4:34 Comment(0)
P
0

Using

npm config set msvs_version=2022 --global
npm ERR! `msvs_version` is not a valid npm option

with space or with = errored for me.

However, npm config edit adding msvs_version={version} in the file directly worked fine.

npm config get msvs_version
2022
Pinafore answered 4/2 at 9:40 Comment(0)
D
0

Update for 2024, sqlite3 lists node-gyp:8 in its dependencies. Windows 11 SDK was added in 9. You need to install Windows 10 SDK even if you have 11.

Dinky answered 7/3 at 22:52 Comment(0)
V
0

I was able to fix this exact issue with this choco command

choco install python --version=3.10.0
choco install microsoft-build-tools --version 12.0.21005.20140416
choco install visualstudio2017community
choco install visualstudio2017-workload-nativedesktop
choco install nodejs.install --version=14.21.2

If you re using NodeJS version 14.X, you should go with Visual Studio 2017.

Venator answered 13/3 at 22:12 Comment(0)
M
-1

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

Montgomery answered 8/8, 2022 at 17:33 Comment(0)
P
-2

Downgrade from version 18 to version 16.. it worked for me.

Payton answered 13/4, 2023 at 22:5 Comment(0)
A
-4

Ensure that you have the latest npm installed.

npm install -g npm@latest

Anatolia answered 14/5, 2021 at 12:49 Comment(0)
D
-6

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

Demarcate answered 8/6, 2021 at 4:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.