How to fix npm

I tried to install togeojson, but I got the following error:

npm install -g @mapbox/togeojson 

npm ERR! Linux 4.4.0-116-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "@mapbox/togeojson"
npm ERR! node v8.0.0-pre
npm ERR! npm  v3.5.3
npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module 'internal/fs'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/nboettcher/Downloads/togeojson/npm-debug.log

Other common error is:

npm ERR! Cannot find module 'ansi'

To solve them, you must reinstall nodejs and npm with the following sentences:

sudo apt-get remove nodejs npm
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install npm
npm install

Now I have npm 3.5.2, but now it works.
Enjoy it!

Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility