[Solved] npm update check failed error

avatar
Borislav Hadzhiev

Last updated: Apr 4, 2024
3 min

banner

# [Solved] npm update check failed error

The error "npm update check failed" occurs when npm tries to check for an update but fails due to permission issues or because of a glitched configstore directory.

To solve the error, delete the configstore directory and update your version of npm.

Here is the complete error message.

shell
┌───────────────────────────────────────────────────────────────────┐ │ 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/bobbyhadz/.config | └───────────────────────────────────────────────────────────────────┘

# Try changing the ownership of the .config directory

If you are on macOS or Linux, try changing the ownership of the .config directory by running the following command.

Make sure to replace the username placeholder with your actual username.
shell
sudo chown -R $USER:$(id -gn $USER) /home/{username}/.config

change-ownership-of-config-directory

The specific command you should run will likely be contained in your error message.

If you got the error when using npm on a remote server (e.g. an AWS EC2 instance), try issuing the following command.

shell
sudo chown -R $USER:$(id -gn $USER) ~/.config

Try to issue an npm command and see if you get the error message afterward.

shell
npm --version

# Deleting the configstore directory

The configstore directory often glitches due to permission issues.

If you delete the directory, it will get re-generated the next time you run an npm command, e.g. npm --version or npm start.

# Deleting configstore on Windows

On Windows, the configstore directory is located at:

  • C:\Users\<username>\.config\configstore

Make sure to replace the <username> placeholder with your actual username.

Go to the C:\Users\<username>\.config folder and delete the configstore folder.

Alternatively, you can delete the folder with a command.

cmd
rd /s /q "C:\Users\<username>\.config\configstore"

Make sure to replace <username> with your actual username.

Try to issue an npm command after deleting the configstore folder.

# Deleting configstore on macOS or Linux

On macOS and Linux, the configstore folder is located at:

  • ~/.config/configstore

  • or /Users/<username>/.config/configstore

view configstore directory on linux

For example, if your .config directory is located at ~/.config/configstore/, you can delete it with the following command.

shell
rm -rf ~/.config/configstore

delete configstore directory

# Update your version of npm

If the error persists, try updating your version of npm.

On Windows, issue the following command.

shell
npm install -g npm@latest

On macOS and Linux, issue the following command.

shell
sudo npm install -g npm@latest

Try to issue an npm command, e.g. npm --version to see if the error persists.

# Disable the notifier with a command

If you still get the error, disable the notifier by running the following command.

shell
npm config set update-notifier false

The command disables the notifier globally, in your npm config.

You can view the value of the update-notifier key with the following command.

shell
npm config get update-notifier

npm config disable update notifier

If you need to delete the update-notifier key, use the following command.

shell
npm config delete update-notifier

# Reinstall Node.js and npm

If the issue persists, reinstall Node.js and npm and install the long-term supported (LTS) version.

You can download the LTS version from the official nodejs.org site.

Alternatively, you can use a Node package manager like nvm:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.