npm not working after clearing cache

node.jsNpm

node.js Problem Overview


Before clearing cache

npm cache clear

npm is working fine. After clearing cache, it is not working. The error log below suggest problem with internet connectivity but internet connection is just fine. This problem does not only happen for bower but for any modules.

Here's the output of process:

> sudo npm install -g bower Password: npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm ERR! network connect ETIMEDOUT
> npm ERR! network This is most likely not a problem with npm itself npm
> ERR! network and is related to network connectivity. npm ERR! network
> In most cases you are behind a proxy or have bad network settings. npm
> ERR! network npm ERR! network If you are behind a proxy, please make
> sure that the npm ERR! network 'proxy' config is set properly.  See:
> 'npm help config'
> 
> npm ERR! System Darwin 12.5.0 npm ERR! command
> "/usr/local/Cellar/node/0.10.16/bin/node" "/usr/local/bin/npm"
> "install" "-g" "bower" npm ERR! cwd /Users/username npm ERR!
> node -v v0.10.16 npm ERR! npm -v 1.3.8 npm ERR! syscall connect npm
> ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! npm ERR!
> Additional logging details can be found in: npm ERR!    
> /Users/username/npm-debug.log npm ERR! not ok code 0

node.js Solutions


Solution 1 - node.js

This worked for me:

npm cache clean --force 

Solution 2 - node.js

It should be

npm cache clean  

See https://docs.npmjs.com/cli/cache.html

Solution 3 - node.js

"As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use

npm cache verify

instead."

Solution 4 - node.js

try this one npm cache clean --force after that run npm cache verify

Solution 5 - node.js

Try npm cache clean --force if it doesn't work then manually delete %appdata%\npm-cache folder.

and install npm install npm@latest -g

It worked for me.

visit this link

Solution 6 - node.js

I try to

npm cache clean 

But npm said newer version on npm (> 5) has self healing Mechanism and every thing i need to do for checking npm is use verify

npm cache verify

npm message :

The npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. 

If you want to make sure everything is consistent, use 'npm cache verify' instead.

but for forcing npm use this:

npm cache clean --force

Solution 7 - node.js

Try npm cache clean --force if it doesn't work then manually delete %appdata%\npm-cache folder.

It worked for me.

Solution 8 - node.js

Environment path may have been removed.

Check it by typing,

npm config get prefix

This must be the location where the npm binaries are found.

In windows, c:/users/username/AppData/Roaming/npm is the place where they are found.

Add this location to the environment variable. It should work fine.

(Control Panel -> Search for 'Environment Variables' and click on a button with that name -> edit Path -> add the above location)

Solution 9 - node.js

at [email protected] the command that is been supported is npm cache verify

Solution 10 - node.js

I solved this issue by running cmd as an administrator. before that, I was trying to run in vs code.

run it in Power Shell or Cmd with administrative privilege. I hope that it will help.

npm install –g @angular/cli@latest

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3044659View Question on Stackoverflow
Solution 1 - node.jsASHISH RView Answer on Stackoverflow
Solution 2 - node.jsPer Quested AronssonView Answer on Stackoverflow
Solution 3 - node.jsRBZView Answer on Stackoverflow
Solution 4 - node.jsAAshish jhaView Answer on Stackoverflow
Solution 5 - node.jsuser12910330View Answer on Stackoverflow
Solution 6 - node.jsMasoud BimmarView Answer on Stackoverflow
Solution 7 - node.jsSaurabh AgrawalView Answer on Stackoverflow
Solution 8 - node.jsMaharaj SanthirView Answer on Stackoverflow
Solution 9 - node.jsmenepetView Answer on Stackoverflow
Solution 10 - node.jsSaad AbbasiView Answer on Stackoverflow