node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Error running npm-install

Open im1dermike opened this issue 9 years ago • 44 comments

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 [email protected]

> [email protected] 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
[email protected] C:\Development\Advaxis\Advaxis.norm\Advaxis.Norm.web
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
`-- UNMET PEER DEPENDENCY [email protected]

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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of @angular/common@^4.0.0 but none was installed.
npm WARN [email protected] requires a peer of @angular/compiler@^4.0.0 but none was installed.
npm WARN [email protected] requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN [email protected] requires a peer of rxjs@~5.0.0-beta.12 but none was installed.
npm WARN [email protected] requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN [email protected] requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\microtime):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

im1dermike avatar May 11 '17 17:05 im1dermike

+1

mercurjl avatar May 11 '17 17:05 mercurjl

+1

gabrielgomez522 avatar May 11 '17 17:05 gabrielgomez522

This has brought our dev team to a halt. When trying to install microtime directly which is kicking off the node-gyp rebuild here is the error(s) I get:

 C:\Users\k_phillips\test  ([email protected])
 npm install [email protected]

 [email protected] install C:\Users\k_phillips\test\node_modules\microtime
 node-gyp rebuild

C:\Users\k_phillips\test\node_modules\microtime>if not defined npm_config_node_gyp (node "C:\Users\k_phillips\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.
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\k_phillips\test\node_modules\microtime\build\microtime.vcxproj]

gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\k_phillips\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
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\\nodejs\\node.exe" "C:\\Users\\k_phillips\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\k_phillips\test\node_modules\microtime
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of rxjs@~5.0.0-beta.12 but none was installed.
npm WARN [email protected] requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN [email protected] requires a peer of zone.js@~0.6.21 but none was installed.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\k_phillips\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"
npm ERR! node v6.10.0
npm ERR! npm  v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the microtime package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs microtime
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls microtime
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\k_phillips\AppData\Roaming\npm-cache\_logs\2017-05-11T17_59_58_211Z-debug.log

ukphillips avatar May 11 '17 18:05 ukphillips

@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

im1dermike avatar May 11 '17 18:05 im1dermike

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

skkonstantin avatar May 11 '17 18:05 skkonstantin

@im1dermike I just noticed that - I am now where you are. VERY frustrating that this has all blown up without a single change to any of our code. All I can assume is a package somewhere in the dependency chain changed that has caused this mess.

ukphillips avatar May 11 '17 18:05 ukphillips

@ukphillips NPM's biggest issue IMO. I'm thinking that changing my package.json file to exclude the ^ prefix to packages so it won't be affected by issues like this with new versions would be smart.

im1dermike avatar May 11 '17 18:05 im1dermike

+1

vikshv avatar May 11 '17 18:05 vikshv

Is this the same issue? The symptom sounds the same https://github.com/nodejs/node-gyp/issues/1144

ukphillips avatar May 11 '17 18:05 ukphillips

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

im1dermike avatar May 11 '17 18:05 im1dermike

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

skkonstantin avatar May 11 '17 18:05 skkonstantin

@nodejs/platform-windows any ideas? Looks like the original issue is

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)

which is indeed the same as https://github.com/nodejs/node-gyp/issues/1144. (so cc/ @refack )

gibfahn avatar May 11 '17 18:05 gibfahn

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!

im1dermike avatar May 11 '17 18:05 im1dermike

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.

gibfahn avatar May 11 '17 19:05 gibfahn

Not 1144, there the error is KeyError: '2017'

@im1dermike 's error has this in log: node-gyp -v v3.4.0 @ukphillips last log shows also old node-gyp: node-gyp -v v3.5.0

First thing to try is to update npm or just node-gyp

refack avatar May 11 '17 19:05 refack

For posterity: doing npm install [email protected] or even npm i -g [email protected] 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

refack avatar May 11 '17 19:05 refack

Found out that npm was using [email protected] while running npm i. But node-gyp -v yields v3.6.1. I went into the npm folder, /Program Files (x86)/.../npm and ran npm i --save [email protected] to bring node-gyp up to date with my global install.

Errors remains (SelectVisualStudioVersion...). Version change reflected in same error stack trace.

skynode avatar May 13 '17 03:05 skynode

Forgot to mention, I'm running [email protected] and [email protected].

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

skynode avatar May 13 '17 03:05 skynode

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

refack avatar May 13 '17 03:05 refack

@refack I ran into this issue today and I've seen that some others have been befuddled by it as well, with seemingly no resolution. I found out something and wanted to share it in case anyone else finds it useful.

Here: https://github.com/nodejs/node-gyp/blob/v3.6.2/lib/find-vs2017.js#L17

I changed that to log.warn instead of log.silly just so I could see what was coming out, and I see a pretty JSON object like I should... except before the pretty JSON object, I have a pesky WARNING: Could not find ssh-agent thanks to posh-git. Looking up and taking care of that issue resolved this issue for me.

tuespetre avatar Sep 14 '17 18:09 tuespetre