felixrieseberg / windows-build-tools

:package: Install C++ Build Tools for Windows using npm
MIT License
3.4k stars 237 forks source link

Issue after running npm install "if not defined npm_config_node_gyp" #227

Open AndresHMosqueda opened 4 years ago

AndresHMosqueda commented 4 years ago

After I run "npm install" I get these errors, I've ran "npm install --g --production windows-build-tools", I've also deleted node_modules, package-lock.json and installed Visual Studio community 2019 but still have the same issue...

C:\Users\myuser\Documents\GitHub\myRepo\node_modules\snappy> if not defined npm_config_node_gyp
"C:\Users\myuser\Documents\GitHub\myRepo\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )

gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.7.30621.155) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - missing any VC++ toolset
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
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 **************************************************************
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 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:20
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1047:16)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Users\myuser\Documents\GitHub\myRepo\node_modules\\node_modules\\node\\bin\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\myuser\Documents\GitHub\myRepo\node_modules\snappy
gyp ERR! node -v v14.10.1
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok

I've deleted version 2017 so the only version installed on my machine is 2019, please your help!!

Nodejs version that I'm using is: v12.8.1, npm version: 6.10.2, python: 2.7.14

MSVS

What should I do to remove that error after running "npm install"?

khacnha commented 3 years ago

my pc the same issue, but i don't install any Visual Studio version.

cjcandctr commented 3 years ago

try this: npm install --global --production windows-build-tools Microsoft Visual C++ build tools are packaged with Visual Studio but now available for npm. see this link for details https://stackoverflow.com/questions/34335043/troubles-with-npm-and-node-gyp-in-windows

after this error fixed, you may need to fix other errors of course.