Skip to content

Potentially unnecessary peer dependency? #237

Open
@andyjakubowski

Description

Installing mdx-embed@^0.0.22 with [email protected] throws an ERESOLVE unable to resolve dependency tree error when react@^17.0.2 is installed as a dependency of [email protected].

I noticed mdx-embed lists react@^16.9.0 as a peerDependency. But @mdx-js/react@^1.6.16 lists react@"^16.13.1 || ^17.0.0". I ran npm install --legacy-peer-deps mdx-embed, which I think may suppress the error in spite of the listed peer dependency. In any case, the installation worked. I ran a quick test and the embedding seems to work.

Does React 17 break mdx-embed in some way, or could react@^16.9.0 be removed from peerDependencies to avoid npm installation errors?

Reproduce with:

npx [email protected]
npm install @mdx-js/mdx @mdx-js/react react react-dom --save
npm install mdx-embed --save

Here’s the output you get after running npm install:

While resolving: blog@undefined
Found: [email protected]
node_modules/react
  react@"^17.0.2" from the root project
  peer react@"^16.13.1 || ^17.0.0" from @mdx-js/[email protected]
  node_modules/@mdx-js/react
    @mdx-js/react@"^1.6.22" from the root project
    peer @mdx-js/react@"^1.6.16" from [email protected]
    node_modules/mdx-embed
      mdx-embed@"*" from the root project

Could not resolve dependency:
peer react@"^16.9.0" from [email protected]
node_modules/mdx-embed
  mdx-embed@"*" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions