Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
6 of 7 tasks
robert-j-webb opened this issue May 26, 2023 · 2 comments · Fixed by #8961
Closed
6 of 7 tasks

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

robert-j-webb opened this issue May 26, 2023 · 2 comments · Fixed by #8961
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@robert-j-webb
Copy link

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.
@robert-j-webb robert-j-webb added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels May 26, 2023
@robert-j-webb
Copy link
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

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label May 30, 2023
@slorber
Copy link
Collaborator

slorber commented May 30, 2023

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

@slorber slorber changed the title Dependency issue with react-tyeps testing-library - Dependency issue with react-types May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants