Resolving npm install hangs issue

Posted on May 16, 2022

A short guide on troubleshooting and resolving npm install command hangs

When running the npm install command to install your project’s dependencies, the install process may hang.

At times, the installation hangs without any output. In the example below, the hang happens when the progress bar is halfway through the process:

$ npm install        
⸨#########⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠇ reify:@ampproject/remapping: 
sill audit bulk request {

This kind of error can happen for many reasons, so here are several things you can check to troubleshoot the error:

Check your network connection

First, make sure that you are connected to the internet and that you can access websites using your browser.

Even though the previously installed packages are cached, npm will still connect to the registry using your network connection when there are dependencies not found in the cache.

If you are offline, then the installation could hang in the middle of the process.

Remove node_modules and package-lock.json

When you’re project is a few years old, then you may have outdated modules installed and registered in your package-lock.json file.

To solve the issue, try removing the entire node_modules/ folder and the package-lock.json file.

Run the commands below:

rm -rf node_modules
rm package-lock.json

Then try running the npm install command again. That may fix the issue.

Check the configured registry

The npm registry is a database of JavaScript packages used for reading and downloading the packages listed in your package.json file.

In the past, there are several npm public registries that mirror the public npm registry.

As of today, the only working public npm registry is the one located at

To fix the npm install hangs issue, check that you are configured to use the right registry with the command below:

npm config get registry

You can set the registry using the following command:

npm config set registry

Once changed, try running npm install command again and see if the installation now works.

Check your proxy settings

If your network connection is behind a proxy, then you may have the wrong proxy settings configured.

You can check the npm proxy settings with npm config list command. Here’s an example of the output:

$ npm config list
; "user" config from /Users/nsebhastian/.npmrc

https-proxy = "" 
proxy = "" 
registry = "" 

You can remove the proxy settings using npm config delete and set the new ones using npm set

npm config delete proxy
npm config delete https-proxy

npm config set proxy ''
npm config set https-proxy ''

If you’re using a proxy authenticator such as CNTLM, then the hangs could come from the proxy authentication issue.

Try switching to NTLMAPS and see if you can get the installation working.

Upgrade npm to the latest version

If you’re using an old version of npm, then you may need to upgrade the npm version to make the installation work.

Use the following command to upgrade your npm:

npm install -g npm@latest

Once the upgrade is finished, run the installation again.

Verify and clear the npm cache

Sometimes, the npm cache can be the issue. You can try to verify your npm cache with the command below:

npm cache verify

That command will verify the contents of the cache folder and remove any unneeded data.

npm will also delete corrupted contents and fetch the data automatically.

Alternatively, you can also force delete your npm cache and ensure fresh package downloads using the clean command below:

npm cache clean --force

Once the cache is cleaned, npm will download dependencies from the internet and store them in the newly emptied cache.

When you’ve tried everything

Sometimes, the hangs could be an issue that’s unidentifiable.

When all else fails, then you can try to restart your computer to see if it works.

If you still see the hangs, then reinstall npm on your computer. It may work miracles.

Thanks for reading, and good luck with the issue! 🙏

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.