Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running npm install #49

Closed
im1dermike opened this issue May 11, 2017 · 20 comments
Closed

Error running npm install #49

im1dermike opened this issue May 11, 2017 · 20 comments

Comments

@im1dermike
Copy link

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:

[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\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
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 [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 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! [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:\Development\npm-debug.log

@skkonstantin
Copy link

+1

@wadey
Copy link
Owner

wadey commented May 11, 2017

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.

@im1dermike
Copy link
Author

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 [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
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

@wadey
Copy link
Owner

wadey commented May 11, 2017

I think you probably need to open a ticket on https://github.com/nodejs/node-gyp because it appears your error is happening in there, before the build steps really get to this library.

@im1dermike
Copy link
Author

For posterity: nodejs/node-gyp#1195

@ukphillips
Copy link

I still think this might be an issue with microtime, here is the error I have:

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]

@wadey
Copy link
Owner

wadey commented May 11, 2017

@ukphillips The key error in there is:

TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. 

Without CL.exe, no native modules can be built. Please install the required tools listed here: https://github.com/nodejs/node-gyp#installation (see the Windows section).

@vikshv
Copy link

vikshv commented May 11, 2017

+1

@cadsit
Copy link

cadsit commented May 11, 2017

I think the issue that affected everyone here is browserify/pbkdf2@ad53c33. 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

@gibfahn
Copy link

gibfahn commented May 11, 2017

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

@im1dermike Native node modules use the GYP build system, which is written in Python. If you're using node-gyp (through npm install or directly) you're compiling a native npm package, which means you need the compiler dependencies (i.e. a C++ compiler and Python).

@wadey
Copy link
Owner

wadey commented May 11, 2017

@cadsit the latest version of pbkdf2 has microtime listed as an optional dependency, so even if you see an error during install it shouldn't fail:

https://github.com/crypto-browserify/pbkdf2/blob/v3.0.11/package.json#L57-L59

@abock
Copy link

abock commented May 11, 2017

I second @cadsit's findings. We also initially worked around this breakage by pinning pbkdf2 to an older version:

"devDependencies": {
  "pbkdf2": "=3.0.9"
}

Basically, https://github.com/crypto-browserify/pbkdf2, should have done a larger version bump due to the build implications (@calvinmetcalf).

@wadey it's specified as optional on GitHub but it's definitely not optional in npm. From node_modules/pbkdf2/package.json on disk, freshly installed:

  "dependencies": {
    "create-hash": "^1.1.2",
    "create-hmac": "^1.1.4",
    "microtime": "^2.1.3",
    "ripemd160": "^2.0.1",
    "safe-buffer": "^5.0.1",
    "sha.js": "^2.4.8"
  },

@abock
Copy link

abock commented May 11, 2017

There are also a number of issues already opened about this against pbkdf2. This issue should probably be closed since it's not specifically @wadey's issue.

@calvinmetcalf
Copy link

and we're fixed

@ukphillips
Copy link

I'm still relatively new to npm - while this did fix my issue, I'm having a hard time grasping how the change resolved (and created) the problem. pbkdf2 from looking at the dependencies depends on microtime - how did making a change to pbkdf2 affect the ability to install microtime?

@wadey
Copy link
Owner

wadey commented May 12, 2017

@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

@calvinmetcalf
Copy link

how did making a change to pbkdf2 affect the ability to install microtime?

I removed microtime from the pbkdf2 dependencies so that now you were no longer trying to install it

@wadey
Copy link
Owner

wadey commented Jun 1, 2017

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.

@feikaixin
Copy link

I can`t understand it....

@preeti-192
Copy link

preeti-192 commented Mar 28, 2024

Exit code: 1
Command: node scripts/build.js
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:210:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
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
gyp ERR! System Windows_NT 10.0.22631
gyp ERR! node -v v18.17.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

I've also got the similar error when I tried installing vue-funnel-graph-js package in nuxt. I've searched a lot but didn't find a proper solution. I've also tried both with python3 and python2 but still won't work.
Any idea about how to fix it? Thankyou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests