2

I used yarn to install almost 1000 js libraries. When it's done I run yarn install --check-files and it warns me that it left out just a few. I find this bizarre that it installs almost all and only warns about not installing a small handful (but I'll read up on why yarn's doing that later), for now, I need to figure out what to do about these unmet peer dependencies?

Example output

yarn install --check-files    
yarn install v1.22.19
[1/4]   Resolving packages...
[2/4]   Fetching packages...
[3/4]   Linking dependencies...
warning " > babel-loader@8.3.0" has unmet peer dependency "@babel/core@^7.0.0".
warning " > babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > babel-plugin-polyfill-corejs3@0.6.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > babel-plugin-polyfill-regenerator@0.4.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > bootstrap@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
[4/4]   Building fresh packages...
✨  Done in 1.52s.

My guess is simply install them with

yarn add @popper.js@^1.16.1
yarn add @babel/core@^7.0.0-0

I'm not totally sure though and want to get it right (also not sure if the first @ and ^ should be there).

Note

Although I already mentioned it above and link to it, I reiterate, that this question differs from What does 'has unmet peer dependency' mean when installing a package with yarn? in that it asked about what a peer dependency is, whereas I (and 90 others) would like to know what must be done with yarn to ensure all (peer) dependencies are installed.

stevec
  • 41,291
  • 27
  • 223
  • 311
  • 2
    Does this answer your question? [What does 'has unmet peer dependency' mean when installing a package with yarn?](https://stackoverflow.com/questions/46928390/what-does-has-unmet-peer-dependency-mean-when-installing-a-package-with-yarn) – jonrsharpe Feb 19 '23 at 14:05
  • 1
    @jonrsharpe no, I [linked to it](https://stackoverflow.com/questions/46928390/what-does-has-unmet-peer-dependency-mean-when-installing-a-package-with-yarn#comment114982226_48767033) in the question above, that it doesn't help with what to do about it (explains what a unmet peer dependency is, sure, but my question is different to that) – stevec Feb 19 '23 at 14:06
  • _"it doesn't help with what to do about it"_ - yes, it does. – jonrsharpe Feb 19 '23 at 14:09
  • @jonrsharpe I edited the question to explain how the question I link to is different. – stevec Feb 19 '23 at 14:14
  • 1
    That question is _also_ covered in the answers on the dupe (both implicitly - as once you know why it's telling you that, what to do about it is pretty obvious - and explicitly). – jonrsharpe Feb 19 '23 at 14:17

1 Answers1

2

How to solve

Copy the name of the unmet peer dependency from the warning message, and add it using yarn like so:

yarn add '<unmet peer dependency>'

don't forget the ' and ' around the dependency, (and keep the @ and ^ symbols if the unmet peer dependency has them).

Example

The error message in the question has

warning " > babel-plugin-polyfill-corejs2@0.3.3" has unmet peer dependency "@babel/core@^7.0.0-0".

so you'd run

yarn add '@babel/core@^7.0.0-0'

to add it.

Repeat this until all the warnings have gone when you run yarn install --check-files and the output just looks something like this (no warnings any more):

yarn install --check-files     
yarn install v1.22.19
[1/4]   Resolving packages...
[2/4]   Fetching packages...
[3/4]   Linking dependencies...
[4/4]   Building fresh packages...
✨  Done in 1.54s.

stevec
  • 41,291
  • 27
  • 223
  • 311