reactchartjs/react-chartjs-2

[Bug]: React 19 not added as a peer dependency

Erod-star opened this issue · 2 comments

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Description ⚠️

I have a project that uses react-chartjs-2 and the 18th version of react and everything used to work just fine. However when I tried to upgrade to React 19, the installation fails when attempting to install dependencies.

The error occurs because I saw @react-chartjs-2 has a peer dependency requirement for react@^16.x || ^17.x || ^18.x, but the project is using React 19.0.0-rc-69d4b800-20241021.

image

The installation works fine with React 18, but I haven't found a workaround. This are some posibble solutions:

  • Update @react-chartjs-2 peer dependencies to include React 19
  • Add a note in the documentation about React 19 compatibility
  • Add a version check in the CLI to warn users about React 19 compatibility issues

Reproduction

https://github.com/Erod-star/react-chartjs-2-react-19-issue

chart.js version

5.2.0

react-chartjs-2 version

5.2.0

Possible solution

No response

@Erod-star FWIW, I've been able to use the --force option with npm install and all has worked fine for me. I admit, however, that this is not ideal and that the project should be updated to accept React 19 as a peer dependency.

You may want to check out this issue, which is for the same thing: #1235