I've tried multiple times to import a library to my React project, but every time I try, an error like this pops up:
# npm resolution error report
While resolving: [email protected]
Found: [email protected]
node_modules/react
peer react@">= 16" from @heroicons/[email protected]
node_modules/@heroicons/react
@heroicons/react@"^2.0.18" from the root project
peerOptional react@"^18.0.0" from [email protected]
node_modules/framer-motion
framer-motion@"^11.0.8" from the root project
peer react@"^18.2.0" from [email protected]
node_modules/next
next@"^14.0.2" from the root project
peer react@"^18.2.0" from [email protected]
node_modules/react-dom
peerOptional react-dom@"^18.0.0" from [email protected]
node_modules/framer-motion
framer-motion@"^11.0.8" from the root project
peer react-dom@"^18.2.0" from [email protected]
node_modules/next
next@"^14.0.2" from the root project
react-dom@"^18.2.0" from the root project
peer react@">= 16.8.0 || 17.x.x || ^18.0.0-0" from [email protected]
node_modules/styled-jsx
styled-jsx@"5.1.1" from [email protected]
node_modules/next
next@"^14.0.2" from the root project
react@"^18.2.0" from the root project
peer react@"*" from [email protected]
node_modules/react-icons
react-icons@"*" from the root project
Could not resolve dependency:
peer react@"^17.0.0" from [email protected]
node_modules/react-server-dom-webpack
react-server-dom-webpack@"^0.0.1" from the root project
Conflicting peer dependency: [email protected]
node_modules/react
peer react@"^17.0.0" from [email protected]
node_modules/react-server-dom-webpack
react-server-dom-webpack@"^0.0.1" from the root project
Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
I have no idea how to fix it, and it seems like ChatGBT doesn't know either.
I tried to import the react-icons library and expected it to be installed without an error.