npm gets stuck on fetchMetadata -> network

Solution 1:

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"

Solution 2:

try yarn installer instead of npm:

sudo npm install -g yarn
yarn install

I found it much more resilient to such problems.