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?
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
.
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.