Next.js Discord

Discord Forum

Next.js 15 app router - npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Avatar
Asiatic LionOP
No matter which package I am install in my new next js 15 app, I am getting same error. Node version up to data. Please help to resolve this error. My package.json looks like this
"scripts": { "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "react": "19.0.0-rc-66855b96-20241106", "react-dom": "19.0.0-rc-66855b96-20241106", "next": "15.0.3" }, "devDependencies": { "postcss": "^8", "tailwindcss": "^3.4.1", "eslint": "^8", "eslint-config-next": "15.0.3" }

And this is the console error while installing packages
npm i react-youtube npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: secure-testing-video-platform@0.1.0 npm ERR! Found: react@19.0.0-rc-66855b96-20241106 npm ERR! node_modules/react npm ERR! react@"19.0.0-rc-66855b96-20241106" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@">=0.14.1" from react-youtube@10.1.0 npm ERR! node_modules/react-youtube npm ERR! react-youtube@"*" 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!
Answered by Asian black bear
npm already tells you how to work around this issue: by using --legacy-peer-deps.
View full answer

2 Replies

Avatar
Asian black bear
npm already tells you how to work around this issue: by using --legacy-peer-deps.
Answer
Avatar
Asian black bear
To understand why this is happening, read this: https://ui.shadcn.com/docs/react-19