Skip to content

testing-library - Dependency issue with react-types #9013

Closed

Description

@robert-j-webb

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

When trying to link @docusaurus/preset-classic into a sample repo, I get this issue:

 npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @testing-library/[email protected]
npm ERR! Found: @types/[email protected]
npm ERR! node_modules/@types/react
npm ERR!   dev @types/react@"^18.0.28" from the root project
npm ERR!   @types/react@"*" from @docusaurus/[email protected]
npm ERR!   packages/docusaurus-module-type-aliases
npm ERR!     @docusaurus/[email protected]
npm ERR!     node_modules/@docusaurus/module-type-aliases
npm ERR!       workspace packages/docusaurus-module-type-aliases from the root project
npm ERR!       10 more (docusaurus-2-classic-typescript-template, ...)
npm ERR!   3 more (@docusaurus/theme-common, @docusaurus/types, @types/react-test-renderer)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @types/react@"^16.9.0 || ^17.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react-hooks
npm ERR!   dev @testing-library/react-hooks@"^8.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @types/[email protected]
npm ERR! node_modules/@types/react
npm ERR!   peerOptional @types/react@"^16.9.0 || ^17.0.0" from @testing-library/[email protected]
npm ERR!   node_modules/@testing-library/react-hooks
npm ERR!     dev @testing-library/react-hooks@"^8.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

If we look at the library in question: React-hooks-testing-library

We see this line: "@types/react": "^16.9.0 || ^17.0.0",

Which conflicts with the root package.json: "@types/react": "^18.0.28",

Reproducible demo

No response

Steps to reproduce

  1. Start a sample project, using the documentation
  2. Run npm link in docusaurus/package/docusaurus-preset-classic`
  3. Observe errors :(

Expected behavior

We should be able to npm link into the repo without issues.

Actual behavior

Error in description

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used: "3.0.0-alpha.0"
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on May 26, 2023
  2. robert-j-webb commented on May 26, 2023

    @robert-j-webb
    Author

    I worked around this by deleting the "@testing-library/react-hooks": "^8.0.1", line from the main package.json. I suppose tests won't compile but it's fine for my use case

  3. removed
    status: needs triage
    on May 30, 2023
  4. slorber commented on May 30, 2023

    @slorber
    Collaborator

    The package itself recommends to use another package with React 18:

    CleanShot 2023-05-30 at 11 53 28@2x

    Considering we are also upgrading to React 18, I'll consider this issue will be fixed as part of the upgrade (#9013)

    The solution will be to not use this package anymore

  5. changed the title [-]Dependency issue with react-tyeps[/-] [+]testing-library - Dependency issue with react-types[/+] on May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions