Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install npm -g won't update npm to the latest version

Tags:

I am using npm v5.3.0. Now I want to update npm to v5.4.1.To do this I type the following in my terminal:

npm install -g npm

without any errors.However when I type npm -v the version I get is the 5.3.0 not the 5.4.1

I have to mention that I have changed the npm prefix to another directory. Any ideas? I use Ubuntu 17.04

That's my console output : enter image description here

like image 293
Manos Kounelakis Avatar asked Sep 11 '17 21:09

Manos Kounelakis


People also ask

Why is npm install failing?

This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.


1 Answers

I solved it on Ubuntu 18.04 LTS by switching to root using sudo su then I run the following

curl -L https://www.npmjs.com/install.sh | sh
like image 194
benjamin mwalimu Avatar answered Oct 05 '22 19:10

benjamin mwalimu