2

Recently I've been a little bit annoyed because after building my project I get a message like this nearly EVERY DAY:

   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │      New patch version of npm available! 6.14.6 -> 6.14.8      │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.14.8   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

so I run npm install -g npm and a few days later or so it's there again with a newer patch (at least I assume so, since I executed that script successfully and don't know of anything that reverts it).

I'm very happy that people are improving it, but is there an easy way for this to update itself?
Because I'd rather manually downgrade it than having to manually upgrade it every time.

1 Answer 1

2

Your message above indicates that you are using npm version 6.x. That release line does not get a new release every day or even every week. In fact, the version in that message (6.14.8) was released 2 months ago. Judging from the 6.x release history, npm 6.x was getting updated about once a month. Now that 7.x is out, it will probably be less frequent. So frequent npm updates may not be your problem. The problem may be that npm updates are not sticking (or working at all) for you for whatever reason.

On the other hand, if you are using npm v7.x, it's a recent release that has been undergoing bug fixes every few days, but that is very likely to slow waaaay down. So one solution may be to just wait another week or two and the updates will be less frequent. (They may already be much less frequent than the were even last week.)

All that said: A blunt hammer solution would be to update npm as the first step in your build process. If you run npm run build as your build step, update package.json to add npm install -g npm && at the front of your build script. If you want to tolerate the npm update failing, you can change && to || but then the message you want to go away will still show up if the npm installation/update fails.

If your build process involves installing Node.js, then putting npm install -g npm after the Node.js installation is the way to go. Node.js ships with npm and it is exceedingly likely that the version that ships with Node.js is not the most recent version.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for clearing this up! I was kinda suspicious from the start that something's not right there - now I finally know what this is about!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.