Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

420
Visualizações
Why should I care if my react project has incorrect/unmet peer dependencies?

Does having incorrect/unmet peer dependencies have any significant impact on my react project. I have read the yarn official documentation and it says:

Peer dependencies are a special type of dependency that would only ever come up if you were publishing your own package.

I am not publishing any package here, just a simple react project with installed dependencies. I don't know why it is the case with my react application but I am getting this warning each time I hit yarn install

[3/4] Linking dependencies...
warning "@react-pdf/renderer > react-reconciler@0.24.0" has incorrect peer dependency "react@^16.0.0".
warning " > @testing-library/user-event@12.8.3" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "aws-amplify > @aws-amplify/analytics > @aws-sdk/client-firehose > @aws-sdk/middleware-retry > react-native-get-random-values@1.8.0" has unmet peer dependency "react-native@>=0.56".
warning " > mobx-devtools-mst@0.9.30" has incorrect peer dependency "mobx@^2.2.0 || ^3.0.0 || ^4.0.0 || ^5.0.0".

Should I take it seriously and add the peer dependencies properly, and If I choose not to do so, does this negatively impact my project? Can they be automatically added? and why yarn does not automatically add them at the time of adding a dependency?

devenv: Using yarn v1.22.18 as my package manager with node:16-buster image.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

There can only be a single package "A" installed into node_modules. If you have two packages "B" and "C"

  • "B" needs "A@1.0.0"
  • "C" needs "A@2.0.0"

In this hypothetical situation assume that "A" removed a function that "B" was using in 2.0.0. When you code is running, you will get a bizarre error that function was not found or undefined.

This is the problem that can arise with mismatched peer dependencies. You get bizarre errors or behaviors that when you look at the stacktrace, your code is not actually involved in.

In many situations, you don't use 100% of the code in all packages, and your packages don't use all of the code in their dependency, but when it does come up, it is a serious pain to fix.

about 4 years ago · Juan Pablo Isaza Relatório

0

Peer Dependencies:-

Let Package X need package Y Version 2.0 to work correctly but you installed package Y Version 1.0 then it will give you a warning you don't need to worry about it if it is just a warning when you upload the source code to the server you will reinstall the packages again on it so packages manager will handle it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda