Home > OS >  How to solve the dependency error of tawk to chat npm package with react 18.1.0?
How to solve the dependency error of tawk to chat npm package with react 18.1.0?

Time:05-10

I am trying to install tawk to chat npm package from https://github.com/tawk/tawk-messenger-react. But I get the following error as attached below. I fear if I choose to install it forcefully, it will mess up my code-base. How can I solve it?

error log URL- https://termbin.com/4q35

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-dom
npm ERR!   react-dom@"^18.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-dom@"^17.0.2" from @tawk.to/[email protected]
npm ERR! node_modules/@tawk.to/tawk-messenger-react
npm ERR!   @tawk.to/tawk-messenger-react@"*" 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 /home/somaya/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/somaya/.npm/_logs/2022-05-07T19_08_49_501Z-debug-0.log

CodePudding user response:

Looks like @tawk.to/tawk-messenger-react@ package isn't compatible with react-dom 18. Try using react-dom@"^17.0.2"

CodePudding user response:

try running npm install <dependencyName> --force or npm install <dependencyName> --legacy-peer-deps

if that doesnt work remove node modules and install packages again

if that also doesnt work then you will have to downgrade your react and react-dom versions

  • Related