How to resolve npm update check failed message in the terminal

Posted on Jun 09, 2022

Learn how you can fix the npm update check failed message in the terminal window

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:   │
│               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! 👍

Level up your programming skills

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

No spam. Unsubscribe anytime.