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
75.18k stars 4.7k forks source link

[bug]: Issue with Verifying Framework in ShadCN Setup (React + Rspack) #3602 #5011

Closed huyixi closed 1 month ago

huyixi commented 1 month ago

Describe the bug

I’m currently trying to set up ShadCN in my project(Rsbuild + React + shadcnui), but I’m encountering an issue during the “Verifying framework” step. The error message I get is:

➜ nlx shadcn@latest add button ✔ You need to create a components.json file to add components. Proceed? … yes

We could not detect a supported framework at /Users/huyixi/i/store-app-demo/frontend. Visit ui.shadcn.com/docs/installation/manual to manually configure your project. Once configured, you can use the cli to add components.

Affected component/components

components.json

How to reproduce

  1. Start a React App with rsbuild(https://rsbuild.dev/)
  2. Install shadcn/ui image

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

MacOS
node -v v22.9.0

Before submitting

lucioreyli commented 1 month ago

You can solve this creating a vite.config.ts file on root of project, run the npx shadcn@latest init and after that you can delete the file vite.config.ts. But you need to manually configure the tailwindcss.

huyixi commented 1 month ago

It can solve my problem. But why?

konstantinpachemski commented 1 month ago

It can solve my problem. But why?

I'm currently encountering the same issue. I can explain to you to better understand why the fix works.

The error comes from the script being unable to detect a supported framework and by creating a vite.config.ts we can trick it into thinking we are using Vite and complete the initialization.

And yeah, under the manual installation section,it's noted that you need to manually config Tailwindcss 👍

oviedo97fer commented 1 week ago

You can solve this creating a vite.config.ts file on root of project, run the npx shadcn@latest init and after that you can delete the file vite.config.ts. But you need to manually configure the tailwindcss.

bro wtf. Im with webpack and this solve my problem installing shadcn components 👍 thanks