remarkablemark/html-react-parser

React 19 RC Error

Oksitaine opened this issue ยท 3 comments

Expected Behavior

I only want to download this librairie with nodes :

npm i html-react-parser

Actual Behavior

I can't use this one with the new version for NextJS 15 RC, and the trust problem is React 19 with new compilator :

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: directusblog@0.1.0
npm ERR! Found: react@19.0.0-rc-f994737d14-20240522
npm ERR! node_modules/react
npm ERR!   react@"19.0.0-rc-f994737d14-20240522" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"0.14 || 15 || 16 || 17 || 18" from html-react-parser@5.1.10
npm ERR! node_modules/html-react-parser
npm ERR!   html-react-parser@"*" 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.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/wglint/.npm/_logs/2024-05-25T22_29_10_622Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/wglint/.npm/_logs/2024-05-25T22_29_10_622Z-debug-0.log

Steps to Reproduce

Install and use the last version of react 19 and try download this node dependancy

Environment

  • Browser: Chrome
  • OS: MacOS

Keywords

I thinks html-react-parser need to update peerDeps for react 19, that will be great !

@Oksitaine thanks for opening this issue, I checked npm and react@19 has not been released yet: https://www.npmjs.com/package/react?activeTab=versions

Can you use overrides or resolutions in your package.json to override the version of html-react-parser in your project?

@remarkablemark I talk about this version of react 19 rc. We can see it in the latest version on he npm page.

I made like you say a overrides in my package.json :

  "dependencies": {
    "babel-plugin-react-compiler": "^0.0.0-experimental-592953e-20240517",
    "html-react-parser": "^5.1.10",
    "next": "15.0.0-rc.0",
    "react": "19.0.0-rc-f994737d14-20240522",
    "react-dom": "19.0.0-rc-f994737d14-20240522"
  },
  "overrides": {
    "html-react-parser": {
      "react": "19.0.0-rc-f994737d14-20240522"
    }
  },

And it's work perfecty ! html-react-parser work great with the new react compilator ( and SSG with Nextjs 15 to ) !

Thanks you for the tips with overrides, it's the first time i use it and it's great !

@Oksitaine Great to hear that overrides works. Since react@19-rc is still a release candidate, we won't update the react version in peerDependencies until the stable version 19 is released.

If the issue is resolved, do you mind closing it?