Eliminate npm “update available” message

2020-05-25 03:56发布

It seems that more recent versions of npm now produce:

enter image description here

I rely on my Linux (Ubuntu) package manager to make decisions about when to update node and npm. Is there a way to turn this check off?

npm config ls -l seems to have nothing related to this and in .npm in my home dir there appears to be no preferences file.

标签: npm
4条回答
Emotional °昔
2楼-- · 2020-05-25 04:06

To disable notifier just run:

npm config set update-notifier false

As Dem Pilafian mentioned - it will add update-notifier=false to ~/.npmrc

To see the current value you need this line

npm config set update-notifier

Read more about npm config here https://docs.npmjs.com/cli/config

查看更多
孤傲高冷的网名
3楼-- · 2020-05-25 04:22

This was annoying me as well, but there's absolutely no information about it anywhere.

Looking through the code, I've found that the update-notifier-module used by npm has actually a couple of ways to turn it off.

The best one is probably the special config-file located at ~/.config/configstore/update-notifier-npm.json (just search for update-notifier-npm.json). Inside it, simply set "optOut" to true.

The other ways to disable it would be setting an environment-variable called "NO_UPDATE_NOTIFIER" or using the argument "--no-update-notifier"

查看更多
叛逆
4楼-- · 2020-05-25 04:23

if you are to parse the npm command output, one option is to format the output, such as "--json true", "npm list --json true", npm will honour the argument and hide the upgrade message.

查看更多
放荡不羁爱自由
5楼-- · 2020-05-25 04:25

update-notifier=false

in .npmrc file seems to do the trick since NPM v6.2.0-next.0 (2018-06-28).

查看更多
登录 后发表回答