Unable to resolve dependency tree with React 18/Next.js
vicentematus opened this issue · comments
Vicente Matus commented
I'm starting a project with Next.js
npx create-next-app my-project
Then i install
npm i little-state-machine
But when i try to install little-state-machine-devtools i have the problem
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR! peer react@"^16.8.0 || ^17 || ^18" from little-state-machine@4.3.2
npm ERR! node_modules/little-state-machine
npm ERR! little-state-machine@"^4.3.2" from the root project
npm ERR! peer little-state-machine@"^4.0.0" from little-state-machine-devtools@2.0.1
npm ERR! node_modules/little-state-machine-devtools
npm ERR! little-state-machine-devtools@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from little-state-machine-devtools@2.0.1
npm ERR! node_modules/little-state-machine-devtools
npm ERR! little-state-machine-devtools@"*" 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.
This is my package.json:
{
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.1.6",
"react": "18.1.0",
"react-dom": "18.1.0"
},
"devDependencies": {
"eslint": "8.15.0",
"eslint-config-next": "12.1.6"
}
}
How can i solve this with React 18/Next.js?
Vicente Matus commented
@bluebill1049 is there anyway you check this?, i'm having peer dependency problems with React 18
Brett Brewer commented
Here's a PR that should work for react 17 & possibly 18:
#55
Vicente Matus commented
Here's a PR that should work for react 17 & possibly 18: #55
Thanks, but i already changed solutions. It broke many of my projects that used little-state-machine package 😢