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
73.47k stars 4.52k forks source link

[bug]: facing issue while trying to install shadcn with npx command, working with bun but not working with npx #5596

Open ctafsiras opened 5 days ago

ctafsiras commented 5 days ago

Describe the bug

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 tailwindcss-animate class-variance-authority lucide-react @radix-ui/react-icons clsx tailwind-merge npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: cybership-io@0.1.0 npm error Found: react@19.0.0-rc-69d4b800-20241021 npm error node_modules/react npm error react@"19.0.0-rc-69d4b800-20241021" from the root project npm error npm error Could not resolve dependency: npm error peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/react-icons@1.3.0 npm error node_modules/@radix-ui/react-icons npm error @radix-ui/react-icons@"*" 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: npm error C:\Users\Tafsir\AppData\Local\npm-cache_logs\2024-10-27T12_41_49_804Z-eresolve-report.txt npm error A complete log of this run can be found in: C:\Users\Tafsir\AppData\Local\npm-cache_logs\2024-10-27T12_41_49_804Z-debug-0.log

Affected component/components

Not installing

How to reproduce

  1. install command given,
  2. see error

Codesandbox/StackBlitz link

No response

Logs

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 tailwindcss-animate class-variance-authority lucide-react @radix-ui/react-icons clsx tailwind-merge
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: cybership-io@0.1.0
npm error Found: react@19.0.0-rc-69d4b800-20241021
npm error node_modules/react
npm error   react@"19.0.0-rc-69d4b800-20241021" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/react-icons@1.3.0
npm error node_modules/@radix-ui/react-icons
npm error   @radix-ui/react-icons@"*" 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:
npm error C:\Users\Tafsir\AppData\Local\npm-cache\_logs\2024-10-27T12_41_49_804Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\Tafsir\AppData\Local\npm-cache\_logs\2024-10-27T12_41_49_804Z-debug-0.log

System Info

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 tailwindcss-animate class-variance-authority lucide-react @radix-ui/react-icons clsx tailwind-merge
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: cybership-io@0.1.0
npm error Found: react@19.0.0-rc-69d4b800-20241021
npm error node_modules/react
npm error   react@"19.0.0-rc-69d4b800-20241021" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/react-icons@1.3.0
npm error node_modules/@radix-ui/react-icons
npm error   @radix-ui/react-icons@"*" 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:
npm error C:\Users\Tafsir\AppData\Local\npm-cache\_logs\2024-10-27T12_41_49_804Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\Tafsir\AppData\Local\npm-cache\_logs\2024-10-27T12_41_49_804Z-debug-0.log

Before submitting

Codescorpio14 commented 5 days ago

Facing the same issue. This happened because Next Js upgrading to react 19 rc version since it is not full released version Shadcn does not support auto installation. Having this problem users will be unable to install shadcn on on projects that are using react 19 rc edition or next js latest version. Hope shadcn patches this issue fast.

this is a temporary fix:

"overrides": {
    "@radix-ui/react-icons": {
        "react": "$react"
    }
}
rlogank commented 5 days ago

One fix is to downgrade to React 18 within your project.

  1. In package.json, set "react" and "react-dom" versions to "^18".
  2. Delete node_modules.
  3. Run npm install in the terminal.
chandima2000 commented 5 days ago

One fix is to downgrade to React 18 within your project.

  1. In package.json, set "react" and "react-dom" versions to "^18".
  2. Delete node_modules.
  3. Run npm install in the terminal.

I have faced the same issue and this method solved my problem. Thank you.

tutorialsmaterials commented 3 days ago

npm install tailwindcss-animate class-variance-authority clsx tailwind-merge check the post https://tutorialsmaterial.com/post/ShadCn-Nextjs-15

sow-coding commented 3 days ago

@shadcn it's a big one

shadcn commented 3 days ago

does the following help? https://ui.shadcn.com/docs/react-19#using-shadcnui-on-nextjs-15