ui: [bug]: pnpm dlx tailwindcss init -p doesn't work anymore
Describe the bug
pnpm dlx tailwindcss init -p doesn’t work anymore
it was what we had to do in tailwind v3 https://v3.tailwindcss.com/docs/installation
tailwind v4 doesn’t require it anymore https://tailwindcss.com/docs/installation/using-vite
I believe you guys should update the doc
Affected component/components
All
How to reproduce
in the installation guide (https://ui.shadcn.com/docs/installation/vite#add-tailwind-and-its-configuration), at step 2: pnpm dlx tailwindcss init -p
Codesandbox/StackBlitz link
No response
Logs
System Info
Windows 11 x64
Node 22.11
Before submitting
- I’ve made research efforts and searched the documentation
- I’ve searched for existing issues
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 23
- Comments: 17
Hey @alfinauzikri, how are you?
I literally just solved this problem here.
I was using
npx tailwindcss@latest init -p, and it gave me the same error. I even analyzed the project code with JsDelivr, and nothing. Until I realized that Tailwind was updated two days ago.I looked at the documentation of the previous stable version (v3.4.17) and saw that it was only updated.
In my case, I modified the command, since the latest version of Tailwindcss was not added to my
package.json.In your case, I think it’s the same, just use:
If anyone is here is wondering about a solution. You should downgrade your
"tailwindcss": "^4.0.0",to"tailwindcss": "^3.3.4"and remove node_modules and package-lock.json and reinstall.This will solve your problem @alfinauzikri
Hi, @Frallan97
I’ve just tried with fresh installation.
node v20.14.0 pnpm 9.15.2
Change the command:
With :
Full Commands:
Results:
Hopefully this will help you resolve your issue…
@LunaticProgrammer
So, the command
npx tailwindcss init -pwill only work if you are in a project that already has the old version of tailwindcss (in this case version 3.4.17 or older). The new version (v4.0.3) no longer has a binary to run this command (npx tailwindcss init -por similar).Until then we have these two options:
Yes, I just had the same problem.
I found another way to do this is keep the version of tailwind to 4 only but while initialising use
npx tailwindcss init -pHope it helps!
I just tested it and solved the problem too. @migtibincoski
And use npm, it is wierd, i can not get it to work with pnpm @alfinauzikri it is weird. But bun works…
@shadcn I’m new to Shadcn and Vite and I’m having this problem with shadcn@canary as well as with shadcn@latest. It looks like Tailwind v4 is just not accepted by shadcn to go ahead.
The @alfinauzikri’s solution with tailwindcss@3.4.17 actually worked. Though I couldn’t get it working with Tailwind upgraded to v4 after setting up the config files.