question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] - Styled components - Module not found: A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't

See original GitHub issue

Bug description

It is an CRA with only styled-components as dependencies see below for repo.

Failed to compile.
./.yarn/$$virtual/styled-components-virtual-3b06c0951a/0/cache/styled-components-npm-5.0.1-87fcb612e6-2.zip/node_modules/styled-components/dist/styled-components.browser.esm.js
Module not found: A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't
yarn dlx @yarnpkg/doctor
 YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 9.79s
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0.15s
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0.4s
➤ YN0000: Done in 10.35s

➤ YN0000: Found 1 package(s) to process
➤ YN0000: For a grand total of 5 file(s) to validate

➤ YN0000: ┌ /home/zerocity/projects/styled-components-yarn-2/package.json
➤ YN0000: │ /home/zerocity/projects/styled-components-yarn-2/package.json:8:36: Unmet transitive peer dependency on @testing-library/dom@>=5, via @testing-library/user-event@^7.1.2
➤ YN0000: │ /home/zerocity/projects/styled-components-yarn-2/package.json:12:26: Unmet transitive peer dependency on react-is@>= 16.8.0, via styled-components@^5.0.1
➤ YN0000: └ Completed in 0.74s

➤ YN0000: Failed with errors in 0.74s

What is the current behavior? Failed to compile.

What is the expected behavior? dont “crash”

Steps to Reproduce

git clone https://github.com/zerocity/styled-components-yarn-2
yarn start

sorry i dont know how i would do this with sherlock

Environment

  • Node Version: 12.14.0
  • Yarn v2 Version: 2.0.0-rc.29
  • OS and version: Linux jerico 5.3.0-29-generic #31-Ubuntu SMP Fri Jan 17 17:27:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sibstarkcommented, Sep 22, 2021
packageExtensions:
  styled-components@*:
    dependencies:
      react-is: "*"

Hello! I tried to fix it with adding this to my .yarnrc.yml but it did not help Adding react-is to package.json solved problem but I think that is wrong way to fix that issue.

1reaction
merceyzcommented, May 15, 2021

styled-components has a peer dependency on react-is so its parent (probably your project) needs to provide it

https://yarnpkg.com/configuration/manifest/#peerDependencies

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve peer dependency error: The package react ...
This seems because I am unable to satisfy some peer dependency but I am unsure which peer dependency I need to fix. λ...
Read more >
Learning the Basics - Gradle User Manual
If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from...
Read more >
[yarn berry] Styled components - Module not found - velog
[Bug] - Styled components - Module not found: A package is trying to access a peer dependency that should be provided by its...
Read more >
Configuration options | Yarn - Package Manager
List of all the configuration option for Yarn (yarnrc files)
Read more >
Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and ... is valid and available; az deployment : Fix the bug of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found