Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ` UNMET PEER DEPENDENCY <packageName> extraneous` mean?

Tags:

npm

I understand that UNMET PEER DEPENDENCY means I need to npm install one of my peerDependencies. I believe that extraneous means the package exists but is not listed in package.json (presumably because it's installed globally?).

What does it mean to have the two of them together?

And why am I seeing this error even though I see these packages in node_modules, at the correct versions?

like image 328
ericsoco Avatar asked Mar 23 '16 19:03

ericsoco


People also ask

What does unmet Peer dependency mean?

UNMET PEER DEPENDENCY error is thrown when the dependencies of one or more modules specified in the package. json file is not met. Check the warnings carefully and update the package. json file with correct versions of dependencies.

How do you fix npm err extraneous?

To resolve extraneous errors in the npm list output, you need to add the packages in your package. json file. Once the upgrade is done, run the npm list command again to see if the extraneous error is still there. Then run the npm install command to install the dependencies again.

What does peer dependency mean?

Having a peer dependency means that your package needs a dependency that is the same exact dependency as the person installing your package. This is useful for packages like react that need to have a single copy of react-dom that is also used by the person installing it.

How do you resolve peer dependencies?

Solution 1: Ignore the peerDependencies The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package.


1 Answers

It means that you have a module installed in your local npm repo that is "extraneous" (meaning you have no dependency on it) that has an "unmet peer dependency" on a library you also do not have installed (or if you do have it installed locally or globally, it is also extraneous so it's not in your dependency tree). If you run npm prune it should remove the extraneous dependency and this message.

like image 101
Adam McCormick Avatar answered Oct 01 '22 10:10

Adam McCormick