node-gyp: Error running npm-install

Today, I started getting errors when running npm install for my web application. I seem to have traced it to npm-gyp. Here is what I get when I try to install it:

$ npm install node-gyp@3.6.1

> microtime@2.1.3 install C:\Development\node_modules\microtime
> node-gyp rebuild


C:\Development\node_modules\microtime>if not defined npm_config_node_gyp (node "C:\Users\me\AppData\Roaming\npm\node_modules\n                                                                                                       pm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Traceback (most recent call last):
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1900, in CalculateVariables
    generator_flags.get('msvs_version', 'auto'))
  File "C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
    versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2017'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "re                                                                                                       build"
gyp ERR! cwd C:\Development\node_modules\microtime
gyp ERR! node -v v7.4.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
Advaxis.Norm.Web@0.0.0 C:\Development\Advaxis\Advaxis.norm\Advaxis.Norm.web
+-- UNMET PEER DEPENDENCY @angular/common@2.4.10
+-- UNMET PEER DEPENDENCY @angular/compiler@2.4.10
+-- UNMET PEER DEPENDENCY @angular/core@2.4.10
+-- node-gyp@3.6.1
+-- UNMET PEER DEPENDENCY rxjs@5.4.0
`-- UNMET PEER DEPENDENCY zone.js@0.7.8

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN angular2-toaster@3.0.1 requires a peer of @angular/common@^4.0.0 but none was installed.
npm WARN angular2-toaster@3.0.1 requires a peer of @angular/compiler@^4.0.0 but none was installed.
npm WARN angular2-toaster@3.0.1 requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN angular2-universal@2.1.0-rc.1 requires a peer of rxjs@~5.0.0-beta.12 but none was installed.
npm WARN angular2-universal@2.1.0-rc.1 requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN angular2-universal-polyfills@2.1.0-rc.1 requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN Advaxis.Norm.Web@0.0.0 No description
npm WARN Advaxis.Norm.Web@0.0.0 No repository field.
npm WARN Advaxis.Norm.Web@0.0.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: microtime@2.1.3 (node_modules\microtime):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: microtime@2.1.3 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 15
  • Comments: 44 (10 by maintainers)

Commits related to this issue

Most upvoted comments

+1

I’m using windows, after the steps described here https://github.com/nodejs/node-gyp#installation, the error was gone

@skkonstantin Which steps did you follow? I ran npm install --global --production windows-build-tools and still have the issue.

First make sure you see

gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok

In the error output.

If you do: look at #1179

Else: do the npm upgrade dance - https://docs.npmjs.com/getting-started/installing-node npm install npm@latest -g

@ukphillips That is where I actually started with this. The microtime author seems to think it’s a node-gyp issue. This has been a huge time waste for my team too. https://github.com/wadey/node-microtime/issues/49

@NitroBAY Thank you!!! npm install -g npm solved!

Refack’s solution saved me after I wasted days with this issue. Try to UPDATE NPM (npm install -g npm) that’s crazy how many days I lost because of that. Couldn’t you check that and advice us to do that somewhere (when the package fails maybe and in the readme). Anyway thanks @refack. Everything has broken when I update my OS. I reinstalled everything from node to meteor but also all packages deleted node-gyp, reinstalled node-gyp, every tools required via every possible way and did one thousand other things

It looks like someone (the author of pdbdf2?) has fixed it. https://github.com/wadey/node-microtime/issues/49. I just blew out my node_modules folder and ran npm install and it looks like it worked!

run this command : meteor npm install --save @babel/runtime All errors will disappear! Magic!!!

After trying for many days, I found that my problem is that the nodejs aerospike client uses node-gyp for building, and the client depends on libss-dev which was not installed on the box I use (VSTS Linux Build Agent).

I added the repo and installed the package before running the npm install:

add-apt-repository 'deb http://security.ubuntu.com/ubuntu xenial-security main'
sudo apt update
sudo apt install g++ libssl1.0.0 libssl-dev

@tuespetre FYI, @dahlbyk landed a fix in posh-git and we landed a fix here (but it still needs to get into a release, then be picked-up by npm)

I did --loglevel=silly and for some reason I did get a ton of those logs but not the ones I was hoping to see from that. Only reason 😛

Well it is called silly 🤷‍♂️ Refs: https://github.com/dahlbyk/posh-git/pull/484

Forgot to mention, I’m running npm@4.2.0 and node@7.10.0.

And SelectVisualStudioVersion​ is same error as KeyError: '2017'.

Be careful, You have to use Python 2.7 (and not 3.7 which is the current latest version).

heapdump@0.3.9 install C:\Users\Lenovo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump node-gyp rebuild

C:\Users\Lenovo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump>if not defined npm_config_node_gyp (node “C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\…..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Windows_NT 10.0.16299 gyp ERR! command “C:\Program Files (x86)\nodejs\node.exe” “C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild” gyp ERR! cwd C:\Users\Lenovo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump gyp ERR! node -v v8.11.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\appium\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“ia32”}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 (node_modules\appium\node_modules\heapdump): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 install: node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

  • appium@1.8.0 updated 1 package in 32.944s

C:\Users\Lenovo>np

Has this been resolved? if it has been resolved can you directed to page and location on page or give me direct feedback

versions = _DetectVisualStudioVersions(version_map[version], ‘e’ in version) KeyError: ‘2017’

attached are my logs KeyError2017.pdf

I have tried this with electron-edge-js electron-edge electron 1.7.9

it seems to be with node-gyp. I can node-gyp build at the root at electron-edge-js and electron-edge but when i try under \tools\build.bat release 7.9.0

electron-edge-js supports Electron 1.7.x - Node.js v7.9.0.

electron-edge Supports Electron 1.7.x - Node.js v7.9.0.

My Computer: Win10 VS2015 Python=2.7.9 angularCLI =latest

Environment Vars: GYP_MSVS_VERSION= 2015

@refack I did --loglevel=silly and for some reason I did get a ton of those logs but not the ones I was hoping to see from that. Only reason 😛

For posterity: doing npm install node-gyp@3.6.1 or even npm i -g node-gyp@3.6.1 Is not sufficient, since when triggering the build of native addons via npm i, npm will use it’s own version of node-gyp, so if you want to use Visual Studio 2017, you’ll need to update npm to a version >= 4.5.0

It looks like someone (the author of pdbdf2?) has fixed it. wadey/node-microtime#49. I just blew out my node_modules folder and ran npm install and it looks like it worked!

So a native module was added to the dependencies, and now it’s been removed again. FWIW it sounds like you can’t install any native modules, so the issue is still there.

@im1dermike , I did the same thing, with administrator root . i think this error came after OS update