node-microtime: Error running npm install

Today, I started getting errors when running npm install on my solution. The error referenced “microtime” which I assume is a dependency of one of my packages. This was the original error:

C:\Development\node_modules\microtime>if not defined npm_config_node_gyp (node “C:\Users\me\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\…..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “” 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 failNoPython (C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14) gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11 gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:112:15) 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” “rebuild” gyp ERR! cwd C:\Development\Advaxis.Norm.web\node_modules\microtime gyp ERR! node -v v7.4.0 gyp ERR! node-gyp -v v3.4.0

I did some researching and trying of suggested solutions. I believe at some point I ran npm install -g node-gyp. Now when I try to run npm install microtime@latest, I get the following error:

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\npm\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” “rebuild” 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 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 ERR! Windows_NT 6.1.7601 npm ERR! argv “C:\Program Files (x86)\nodejs\node.exe” “C:\Users\me\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “install” “microtime@latest” npm ERR! node v7.4.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE

npm ERR! microtime@2.1.3 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the microtime@2.1.3 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:\Development\npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

FYI to everyone that had issues here. The latest release (2.1.4) of microtime now uses node-pre-gyp to provide pre-built binaries for Windows users.

I think the issue that affected everyone here is https://github.com/crypto-browserify/pbkdf2/commit/ad53c33ff1bb51ee9d7586a974feab9b3925854e. That bump essentially screwed over everyone using browserify.

I can verify that running the following in an elevated CMD works on Windows (after installing Python 2.7 and setting %PYTHON%):

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

@ukphillips your computer is not set up to compile and build any native C++ modules (like microtime). You didn’t notice before because nothing in your project used native modules, but when pbkdf2 added microtime as a dependency you encountered your first native module. So the answer is, your computer could never install microtime, you just didn’t notice before. If you want to install native modules, you need to follow these steps: https://github.com/nodejs/node-gyp#installation

I just re-ran the automated builds and microtime builds on windows for all current versions of Node.js: https://ci.appveyor.com/project/WadeSimmons/node-microtime/build/88

Here is my challenge… this is for a web application. Why python would be needed for whatever javascript library is using is it concerning.

Ignoring that, I just tried to install that specific version of node-gyp (which is a dependency for who knows what library I’m importing) and get this:

$ 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

Your first error says:

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

So check that you have python installed and set up correctly.

The second error says:

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'

I’m guessing you are using VS2017? It looks like support for that version was added in node-gyp 3.6.0, so try upgrading your node-gyp.