NPM: Cannot find module 'node -gyp / bin / node -gyp'

I am using NPM under my ubuntu 14.04 and node 8.0.0 .

I upgraded my npm from 5.2.0 to 5.6.0

but after that all npm commands do not work, indicating a problem:

Scam node / bin / scam node

The full log is as follows:

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'node-gyp/bin/node-gyp'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/khalidvm/.npm/_logs/2018-01-12T15_02_35_338Z-debug.log
khalidvm@ubuntu:~/Desktop$ gedit /home/khalidvm/.npm/_logs/2018-01-12T15_02_35_338Z-debug.log
^C
khalidvm@ubuntu:~/Desktop$ sudo npm uninstall npm -g
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'node-gyp/bin/node-gyp'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/khalidvm/.npm/_logs/2018-01-12T15_05_25_322Z-debug.log

I am afraid that I cannot use npm, even deleting it throws the same error.

+11
source share
1 answer

Ubuntu 14.04, ( , 0.xx) . , : https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

, node-gyp. , /usr/local. node.

, :

  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/

, :

  rm -rf ~/.node-gyp/
  rm -rf ~/.npm/

:

sudo apt-get remove --purge nodejs
sudo apt-get install nodejs
+6

All Articles