question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm install fails due to node-gyp errors

See original GitHub issue
  • Node Version: v14.1.0
  • Platform: Microsoft Windows 10 Home, 10.0.18363 Build 10.0.18363
  • Compiler: MSBuild 15.0, using VS 2019 and Python 3
  • Module: Any module, in this case robotjs
Verbose output (from npm or node-gyp):

npm --verbose npm info it worked if it ends with ok npm verb cli [ npm verb cli ‘C:\nodejs\node.exe’, npm verb cli ‘C:\nodejs\node_modules\npm\bin\npm-cli.js’, npm verb cli ‘–verbose’ npm verb cli ] npm info using npm@6.14.4 npm info using node@v14.1.0

Usage: npm <command>

where <command> is one of: access, adduser, audit, bin, bugs, c, cache, ci, cit, clean-install, clean-install-test, completion, config, create, ddp, dedupe, deprecate, dist-tag, docs, doctor, edit, explore, fund, get, help, help-search, hook, i, init, install, install-ci-test, install-test, it, link, list, ln, login, logout, ls, org, outdated, owner, pack, ping, prefix, profile, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, token, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami

npm <command> -h quick help on <command> npm -l display full usage info npm help <term> search for help on <term> npm help npm involved overview

Specify configs in the ini-formatted file: C:\Users\Shubham Bhardwaj.npmrc or on the command line via: npm <command> --key value Config info can be viewed via: npm help config

npm@6.14.4 C:\nvm\v14.1.0\node_modules\npm

Error Description > robotjs@0.6.0 install C:\nodejs\node_modules\robotjs > prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=14.1.0 runtime=node arch=x64 libc= platform=win32) gyp ERR! UNCAUGHT EXCEPTION gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe ENOENT gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19) gyp ERR! stack at onErrorNT (internal/child_process.js:468:16) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command “C:\nodejs\node.exe” “C:\nodejs\node_modules\node-gyp\bin\node-gyp.js” “rebuild” gyp ERR! cwd C:\nodejs\node_modules\robotjs gyp ERR! node -v v14.1.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! This is a bug in node-gyp. gyp ERR! Try to update node-gyp and file an Issue if it does not help: gyp ERR! https://github.com/nodejs/node-gyp/issues npm ERR! code ELIFECYCLE npm ERR! errno 7 npm ERR! robotjs@0.6.0 install: prebuild-install || node-gyp rebuild npm ERR! Exit status 7 npm ERR! npm ERR! Failed at the robotjs@0.6.0 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\Shubham Bhardwaj\AppData\Roaming\npm-cache_logs\2020-05-03T09_31_41_003Z-debug.log

I tried a lot of solutions, but of no use. Please guide the way forward. I’ve been stuck on this for 2-3 days now.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:23 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
jabbar86commented, Oct 5, 2020
gyp info using node-gyp@7.1.0
gyp info using node@14.9.0 | win32 | x64
gyp info find Python using Python version 3.8.5 found at "C:\Python38\python.exe"
gyp info find VS using VS2019 (16.7.30523.141) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python38\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\Zoop\\zoop-product-v0\\src\\node_modules\\x509\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\jabba\\AppData\\Local\\node-gyp\\Cache\\14.9.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\jabba\\AppData\\Local\\node-gyp\\Cache\\14.9.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\jabba\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.9.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=E:\\Zoop\\zoop-product-v0\\src\\node_modules\\x509',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'E:\\Zoop\\zoop-product-v0\\src\\node_modules\\x509\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
E:\Zoop\zoop-product-v0\src\node_modules\x509\build\x509.vcxproj(21,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\jabba\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Zoop\zoop-product-v0\src\node_modules\x509```

Getting this error 
node : 14.9.0
python : 3.8
visual studio : 2019

UPDATE :

This works for me 😃

npm install -g node-gyp

export npm_config_node_gyp=/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js

rm -rf node_modules(if already there)

npm install
0reactions
cclausscommented, Jan 13, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM install fails with node-gyp - Stack Overflow
At first it complained that it needed python, so we installed that. Then it complained that it needed VCBuild, which we installed (using...
Read more >
cannot install npm and error show gyp error #2643 - GitHub
I install npm in terminal problem is here npm ERR! path D:\useful Laravel ...
Read more >
FIX - Windows NPM Node-gyp error for various NPM modules
If you've ever tried to install an NPM module like Xml2Js and received these pretty little errors followed by a failure to install...
Read more >
Solving common issues with node-gyp - LogRocket Blog
Due to historical reasons, which we'll outline in this article, using node-gyp can easily result in problems that are hard to resolve.
Read more >
Run Into a NPM Node-gyp Compilation Error on Windows 10 ...
This error can happen when you are installing a number of packages from NPM that depend on binaries being compiled in order for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found