Failure to install Sweetalert React package
Author: tomasantunesCreated Jan 20, 2023Updated Jan 14, 2026
When I try to install the package @sweetalert/with-react I get the following error:
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
npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.x.x" from @sweetalert/[email protected]
npm ERR! node_modules/@sweetalert/with-react
npm ERR! @sweetalert/with-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!
npm ERR! For a full report see:
npm ERR! /home/user1/.npm/_logs/2023-01-20T19_48_50_781Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user1/.npm/_logs/2023-01-20T19_48_50_781Z-debug-0.log
Steps to reproduce:
npx create-react-app test1
cd test1
npm install --save @sweetalert/with-react
Source: t4t5/sweetalert