shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
74.51k stars 4.61k forks source link

[bug]: npx shadcn@latest add sidebar-05 fails with (NextJs 15 or react 19) #5690

Closed Sujood-Qureshi closed 1 week ago

Sujood-Qureshi commented 1 week ago

Describe the bug

when installing sidebar-5 components using npx shadcn@latest add sidebar-05 getting the error related to --legacy-peer-deps. When using cli command it should ask to use --force or --legacy-peer-deps but its not asking for it.

Affected component/components

sidebar-5 (block)

How to reproduce

  1. Copy the command npx shadcn@latest add sidebar-05.
  2. Navigate to your project's root directory in you terminal.
  3. Paste and run the command.
  4. You will get the error

Codesandbox/StackBlitz link

No response

Logs

✔ Checking registry.
✔ Updating tailwind.config.ts
✔ Updating src\app\globals.css
⠏ Installing dependencies.
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with exit code 1: npm install @radix-ui/react-slot class-variance-authority lucide-react @radix-ui/react-separator @radix-ui/react-dialog @radix-ui/react-tooltip @radix-ui/react-label @radix-ui/react-collapsible
npm warn ERESOLVE overriding peer dependency
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @radix-ui/react-icons@1.3.1
npm error Found: react@19.0.0-rc-02c0e824-20241028
npm error node_modules/react
npm error   peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from react-remove-scroll@2.6.0
npm error   node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll
npm error     react-remove-scroll@"2.6.0" from @radix-ui/react-dialog@1.1.2
npm error     node_modules/@radix-ui/react-dialog
npm error       @radix-ui/react-dialog@"*" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.x || ^17.x || ^18.x || ^19.x" from @radix-ui/react-icons@1.3.1
npm error node_modules/@radix-ui/react-icons
npm error   @radix-ui/react-icons@"^1.3.1" from the root project
npm error
npm error Conflicting peer dependency: react@18.3.1
npm error node_modules/react
npm error   peer react@"^16.x || ^17.x || ^18.x || ^19.x" from @radix-ui/react-icons@1.3.1
npm error   node_modules/@radix-ui/react-icons
npm error     @radix-ui/react-icons@"^1.3.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:

System Info

I am using node version v20.17.0

Before submitting

justinherrera commented 1 week ago

Can you verify to install other ui? I believe it will also fail. Im facing the same issue, yesterday I successfully migrated from 14 to next 15 and just today everything fails

duc-dev commented 1 week ago

Use shadcn@2.1.3 instead: npx shadcn@2.1.3 add sidebar-05

Sujood-Qureshi commented 1 week ago

Can you verify to install other ui? I believe it will also fail. Im facing the same issue, yesterday I successfully migrated from 14 to next 15 and just today everything fails

Yes it failed for other ui components too. but for now to resolve this error i just downgraded my react and react-dom version from 19 to 18. Although react18 is working good with NextJs 15.

shadcn commented 1 week ago

I'm going to temporarily bring back the npm flags. Let's track in https://github.com/shadcn-ui/ui/issues/5557 please.