How to resolve npm update check failed message in the terminal

When running npm commands in the terminal, you might see an error message pop up as shown below:

┌───────────────────────────────────────────────────────────────────┐
│                      npm update check failed                      │
│                Try running with sudo or get access                │
│               to the local update config store via                │
│ sudo chown -R $USER:$(id -gn $USER) /Users/nsebhastian/.config    │
└───────────────────────────────────────────────────────────────────┘

The error above happens when npm is trying to check whether a newer version of the npm package is available for you to download.

When run successfully and there’s a newer npm version, the message will be similar as follows:

╭───────────────────────────────────────────────────────────────╮
│                                                               │
│       New minor version of npm available! 8.1.0 → 8.9.0       │
│   Changelog: https://github.com/npm/cli/releases/tag/v8.9.0   │
│               Run npm install -g npm to update!               │
│                                                               │
╰───────────────────────────────────────────────────────────────╯

As the error message stated, the npm update check failed when npm can’t access the local configstore/ folder.

That folder is located inside the /Users/<username>/.config/ folder.

For Windows computers, the location is in C:\Users\<username>\.config.

Inside the configstore/ folder, you will find a file named update-notifier-npm.json that npm needs to run the update check successfully.

To resolve this issue, you need to make sure that the terminal can access the /.config folder.

There are two ways you can achieve this:

  • Run the terminal with sudo or administrator role, then run an npm command once (npm -v will do)
  • If that doesn’t work, delete the configstore/ folder from /Users/<username>/.config/

The first method will help by restoring the right permissions for the .config/ and configstore/ folders.

The second method will let npm regenerate the configstore/ folder and the update-notifier-npm.json file.

Alternatively, you can turn off the update notifier if you don’t need it:

npm config set update-notifier false

The command above will add update-notifier=false line to your .npmrc file. It will disable the update notifier.

Now you’ve learned how to resolve the npm update check failed message. Nice work! 👍

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.