Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resolve 'yarn package has unmet peer dependency'

I get a load of warnings when I run yarn upgrade or install because of unmet peerDependencies.

warning " > [email protected]" has unmet peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning " > [email protected]" has unmet peer dependency "@babel/core@^7.0.0".

As I understand it, the listed packages need the dependency, and another package in my project has the dependency, I can find the deps but I can't find any information about how to direct the said packages to the sub dependency that I know exists.

How can I get yarn to quiet down and show it where these deps are?

like image 727
Joff Avatar asked Dec 27 '18 15:12

Joff


People also ask

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.

How do you install peer dependencies in yarn?

Run npm install (or yarn install ) to install prod and dev , as well as peer dependencies. You still may see "unmet peer dependency" warnings, due to installation flow of npm/yarn. Also it won't update lock (shrinkwrap) files or modify package. json, keeping your setup pure and clean.

What is yarn Peer dependency?

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.

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.


1 Answers

Both warnings are about peer dependencies, which means that it's your application's responsibility to provide those packages as dependencies.

In this case graphql and @babel/core are expected to be installed in your root app.

like image 195
Andrea Carraro Avatar answered Oct 12 '22 01:10

Andrea Carraro