NPM : Cannot find module 'node-gyp/bin/node-gyp'
For me (Arch Linux) it was enough to install node-gyp via pacman:
sudo pacman -Sy node-gyp
For Arch see: https://www.archlinux.org/packages/community/any/node-gyp/
sudo apt-get install node-gyp
For Ubuntu see: https://packages.ubuntu.com/de/trusty/web/node-gyp
Also on Arch Linux, for me, it worked when removed nodejs and dependencies and reinstall node and npm.
sudo pacman -Rcns nodejs
sudo pacman -S nodejs
sudo pacman -S npm
extra good stuff here.
If you're running the default installation of node on Ubuntu 14.04, the package should be out of date (I believe it's a 0.xx version) and be the source of your problems. You can fix that by looking here: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
Working with an up-to-date distribution of node, I had the same problem with node-gyp
. It turned out that I had a ghost installation under /usr/local
. That was ghosting my node
executable.
After deleting it by running:
sudo rm -rf /usr/local/bin/node-gyp
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/npx
sudo rm -rf /usr/local/lib/node_modules/
and cleaning node files in my home directory, for precaution:
rm -rf ~/.node-gyp/
rm -rf ~/.npm/
I uninstalled the current node installation, and reinstalled:
sudo apt-get remove --purge nodejs
sudo apt-get install nodejs