Leo
Leo

Reputation: 4428

Why do I have to update npm every time I install a new library?

I am not sure that this happens (will happen) every time I install a new library, but at least I have seen this many times now after installing a library with npm:

Update available 5.6.0 → 5.8.0   
     Run npm i -g npm to update

I do that, of course, and the next time I install a library it happens again. I think I did not see that when I started using npm.

What could be going on here?

(I am on Windows 10 when doing this. After updating npm --version says 5.8.0. Next time I will check before...)

EDIT: Just checked with npm --version when I got the message to update. The version is 5.8.0, not 5.6.0. Quite strange.

Upvotes: 1

Views: 1073

Answers (1)

AkinsTech
AkinsTech

Reputation: 164

On Windows note that there is a difference between running

npm install -g npm

when running as a normal user in a non-elevated command prompt, and running it in an elevated "Administrator" command prompt.

First, determine where npm is installed

where npm

If npm is installed under "Program Files", then you'll want to be in an elevated Administrator command prompt when you upgrade. If npm is installed under your user's AppData folder, then you'll want to be running as your user in a non-elevated command prompt.

Upvotes: 1

Related Questions