user3357926
user3357926

Reputation: 1137

shadcn/ui failed to resolve dependencies when initialized in Next.js 15

I encounter the following the depedency errors when initializing shadcn/ui in Next.js 15,

$ npx create-next-app@rc --empty dummy
...

$ npx shadcn-ui@latest init
√ Which style would you like to use? » Default
√ Which color would you like to use as base color? » Slate
√ Would you like to use CSS variables for colors? ... no / yes

✔ Writing components.json...
✔ Initializing project...
⠙ Installing dependencies...Command failed with exit code 1: npm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
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@"19.0.0-rc-f994737d14-20240522" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.5.1 || ^17.0.0 || ^18.0.0" from [email protected]
npm ERR! node_modules/lucide-react
npm ERR!   lucide-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! C:\Users\mjohn\AppData\Local\npm-cache\_logs\2024-05-27T07_23_52_988Z-eresolve-report.txt

Do you have any idea of what could be the problem?

Upvotes: 3

Views: 561

Answers (1)

Oswin
Oswin

Reputation: 11

Try running

npm config set legacy-peer-deps true

Upvotes: 0

Related Questions