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
I had a similar issue to @giridhar but it wasn't related to the proxy, just that my ssh key wasn't setup properly. When trying to do a git ls-remote from an ssh:// url. I was getting the prompt to enter my passphrase for my ssh key.
I had to run these commands on command line in order to stop getting asked for my pass phrase:
$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/id_rsa
Once you enter your pass phrase, then you don't have to enter it again anymore.
I highly recommend reading this wiki from Atlassian if you need to setup an ssh key: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
I had this same problem, with several different installs hanging on fetchMetaData
, including the install of yarn
mentioned above. I am on a Mac
and solved it by updating npm
as follows:
npm install npm@latest -g
So if you are encountering this issue on Mac
, then try updating and see if it solves your problem.
Check if there any issues with proxies if you using any. You can try also to set npm's endpoint manually:
npm config set registry="http://registry.npmjs.org"
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.
For the major chunk of the people, the issue could be related to proxy settings and can be solved by the above-mentioned solutions.
For me, the issue was something else. I have private repository dependencies which are hosted at Bitbucket and are resolved through "git+ssh://git@bitbucket.org/" which intern uses SSH to retrieve the repo.
SSH by default prefers IPv6 if DNS retrieves AAAA record and if the host has one. Since Bitbucket does have AAAA record, SSH is done over IPv6. But my ISP doesn't support IPv6 (You could check if your ISP support's IPv6 by taking a test in http://ipv6-test.com/).
To solve this, you could force SSH client to use IPv4 instead of IPv6.
Set AddressFamily inet
in /etc/ssh/ssh_config
and restart SSH client.
On Ubuntu to restart SSH client use sudo service ssh restart