I am trying to deploy my next app on vercel and the react-html-parser is throwing error I thought about downloading an older version of react but there are other dependencies that required newest version Is there a solution for this case?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR! peer react@">=16.8.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/react
npm ERR! @emotion/react@"^11.9.3" from the root project
npm ERR! peer @emotion/react@"^11.0.0-rc.0" from @emotion/[email protected]
npm ERR! node_modules/@emotion/styled
npm ERR! @emotion/styled@"^11.9.3" from the root project
npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers)
npm ERR! 4 more (@mui/material, @mui/styled-engine, @mui/system, @mui/x-date-pickers)
npm ERR! 24 more (@emotion/styled, @mui/base, @mui/icons-material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0-0" from [email protected]
npm ERR! node_modules/react-html-parser
npm ERR! react-html-parser@"^2.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0-0" from [email protected]
npm ERR! node_modules/react-html-parser
npm ERR! react-html-parser@"^2.0.2" 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! See /vercel/.npm/eresolve-report.txt for a full report.
Use html-react-parser instead of React-html-parser
, the last release for react-html-parser
in 2017
It's work for me, usage is same.
import HtmlParser from "html-react-parser";
//...
{ HtmlParser("<h2>Hello World!</h2>")}
//...