My npm is getting stuck a lot, whether its npm install from package.json or individual packages.
Right now, I'm not even able to sudo npm install node-inspector -g
I'm using node 6.2.1
, npm 3.9.5
on ubuntu 16.04
npm cache clear
didnt help.
The installation takes hours or fails.
Check if there any issues with proxies if you using any. You can try also to set npm's endpoint manually:
For me it was double temp directories in Windows.
Open a command prompt and type:
You should receive path to a single directory. If you receive multiple directories (I received C:\Users\\AppData\Local\Temp;C:\xampp\php) this might be the problem. You can fix it using this command:
where
<correct path to temporary directory>
might be the first path (before semicolon, that meansC:\Users\<user>\AppData\Local\Temp
in my case).I had this same problem, with several different installs hanging on
fetchMetaData
, including the install ofyarn
mentioned above. I am on aMac
and solved it by updatingnpm
as follows:So if you are encountering this issue on
Mac
, then try updating and see if it solves your problem.Having same problem. Fixed it by switching to correct version of node required by the project.
My project needed node
>=v4.3 and <=v5.
1) Check node version being used by
nvm ls
2) Use
nvm use [version]
or else install the specific version. if you don't have.There are a lot of different things that can cause this issue.
I had tried a lot of things, including most of the answers posted here, but no luck.
For some weird reason, this was my ISP's issue. It worked fine when I tried on a different ISP.
Did you configured a proxy? See if this returns something:
If you have values configured there, they might not match correct ones. If you shouldn't be using a proxy, you can delete them:
Docs: https://docs.npmjs.com/cli/config