Skip to content

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

@robert-j-webb

Description

@robert-j-webb

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

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/react-hooks@8.0.1
npm ERR! Found: @types/react@18.2.7
npm ERR! node_modules/@types/react
npm ERR!   dev @types/react@"^18.0.28" from the root project
npm ERR!   @types/react@"*" from @docusaurus/module-type-aliases@3.0.0-alpha.0
npm ERR!   packages/docusaurus-module-type-aliases
npm ERR!     @docusaurus/module-type-aliases@3.0.0-alpha.0
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/react-hooks@8.0.1
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/react@17.0.60
npm ERR! node_modules/@types/react
npm ERR!   peerOptional @types/react@"^16.9.0 || ^17.0.0" from @testing-library/react-hooks@8.0.1
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions