'Eliminate npm "update available" message
It seems that more recent versions of npm now produce:
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.
Solution 1:[1]
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 get update-notifier
Read more about npm config here https://docs.npmjs.com/cli/config
Solution 2:[2]
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"
Solution 3:[3]
in .npmrc
file seems to do the trick since NPM v6.2.0-next.0 (2018-06-28).
Solution 4:[4]
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.
Solution 5:[5]
I created an ansible task that sets optOut
to true
and lastUpdateCheck
to the current date.
In tasks/main.yml
:
---
- name: copy update-notifier-npm template file to disable checking for npm updates
template: src=update-notifier-npm.j2 dest=~/.config/configstore/update-notifier-npm.json
In templates/update-notifier-npm.j2
:
{
"optOut": true,
"lastUpdateCheck": {{ ansible_date_time.epoch }}000
}
The logic that creates this file in the update-notifier
package is here:
https://github.com/yeoman/update-notifier/blob/3fdb21876aa391f9bc7dc35b7d81151677fb533d/index.js#L53
Solution 6:[6]
For newer (v7+) npm you can use export NPM_CONFIG_UPDATE_NOTIFIER=true
to disable via environment
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | myf |
Solution 2 | |
Solution 3 | |
Solution 4 | Zhendong |
Solution 5 | |
Solution 6 | Michael Kriese |