Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install gets stuck at fetchMetadata

Tags:

node.js

npm

I'm currently unable to run npm install in any project since today. I'm running node v8.2.1 & npm 5.3.0 (installed via nvm).

When typing npm install it gets stuck on fetchMetadata everytime: ⸨ ░░░░░░░░░░░░░░░░⸩ ⠧ fetchMetadata: sill pacote range manifest for longest@^1.0.1 fetched in 197ms

I've tried switching back to npm 5.0.3 which worked flawless, but still get stuck.

Details to my computer: MacBook Pro running macOS 10.12.6

like image 316
dschu Avatar asked Aug 01 '17 08:08

dschu


People also ask

Why npm install stuck?

Remove node_modules and package-lock. To solve the issue, try removing the entire node_modules/ folder and the package-lock. json file. Then try running the npm install command again. That may fix the issue.

Why npm is not installing?

On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

How do I force an npm package to install?

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk. The -g or --global argument will cause npm to install the package globally rather than locally.


2 Answers

This is how I resolved this after spending half an hour:

  1. npm config set registry http://registry.npmjs.org/ --global
  2. npm cache clear --force
  3. setting package-lock.json to {} only
  4. npm install --verbose

node: v12.14.1 npm: v6.13.4

This issue occure when I tried running ng update on angular 6 app to update it to angular 9.

like image 139
Sami Haroon Avatar answered Sep 24 '22 06:09

Sami Haroon


As a first thing, run npm install --verbose to see more!

What happened in my case:

In your package.json search for packages you directly get from Github. In my case such a package did not exist anymore. Such lines look like

"NAME_OF_PACKAGE": "git+ssh://[email protected]/SOME_USER/NAME_OF_PACKAGE.git", 

Remove the package, fix the name/location or change to the npm version of the package.


Further note: I got several other similar errors, all the same but the package name was different from longest@^1.0.1. I also had p-try@something or array-ify@something


For me all that didn't work: rm -rf ~/.npm, npm cache clean or rm package-lock.json all didn't work!

like image 33
Andru Avatar answered Sep 26 '22 06:09

Andru