I'm trying to build Atom. When I run npm install
, I get an error:
Error: Cannot find module 'C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js'
I'm on Windows. How can I fix this?
gyp ERR! stackError: Can't find Python executable "python", you can setthe PYTHON env variable. This is because the project you're trying to build requires the node-gyppackage to build something natively on the platform. That package required Python 2.7 and a few other pieces too. The Solution Simple problems sometimes get simple solutions.
A Comprehensive Guide to Fixing Node-Gyp Issues on Windows 1. Try running npm install with the --no-optional flag.. If you’re lucky, the dependency that requires node-gyp will be... 2. Try downloading the windows-build-tools package.. According to the node-gyp documentation, this step should be ...
node-gyp is a tool that enables the compilation of native add-on modules for Node in multiple platforms. It has widespread use and is included as a dependency in many NPM packages. On most systems, this isn’t an issue, and installing node-gyp with the rest of your packages works as expected.
You’ll have to run this command: npm config set msvs_version 2015 –global 5. Make sure you have Python 2.7 installed. Next up is to download Python 2.7. This is important–by default, you’ll install the newest version (3.x.x), but only 2.7 is compatible with node-gyp.
Update 2020: there are reports in the comments that this method (which definitely worked in 2014) does not work anymore. Please make a backup of this folder before deleting anything.
This means that somehow, the node-gyp
module has been corrupted, uninstalled, or otherwise screwed up. This is can be fixed in two easy steps(tm):
Nuke node-gyp
from orbit just in case of corruption or something. Open PowerShell as an administrator, cd
to the install directory of Node (probably either C:\Program Files (x86)\nodejs
or C:\Program Files\nodejs
). Now cd .\node_modules\npm\node_modules
and rm -r node-gyp
.
Reinstall node-gyp
. To do this, just run npm install
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With