node-gyp errors on "Cannot find module" on Windows
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 eitherC:\Program Files (x86)\nodejs
orC:\Program Files\nodejs
). Nowcd .\node_modules\npm\node_modules
andrm -r node-gyp
.Reinstall
node-gyp
. To do this, just runnpm install
.
strugee
Updated on September 03, 2021Comments
-
strugee over 2 years
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?