[bug]: Shadcn not validating Tailwind CSS installation after Tailwind 4 update
Describe the bug
After the update to Tailwind CSS 4, the npx shadcn@latest init command fails to validate the Tailwind CSS installation due to the removal of the Tailwind config file. This prevents the proper initialization of Shadcn. It is recommended to update the installation documentation to reflect these changes.
Affected component/components
N/A (This issue affects the initialization process rather than specific components)
How to reproduce
- Update Tailwind CSS to version 4.
- Run the command
npx shadcn@latest init. - Observe that the command fails to validate the Tailwind CSS installation.
Codesandbox/StackBlitz link
No response
Logs
✔ Preflight checks.
✔ Verifying framework. Found Vite.
✖ Validating Tailwind CSS.
✖ Validating import alias.
No Tailwind CSS configuration found at C:\Users\ranbi\OneDrive\Desktop\Portfolio website\client.
It is likely you do not have Tailwind CSS installed or have an invalid configuration.
Install Tailwind CSS then try again.
Visit https://tailwindcss.com/docs/guides/vite to get started.
No import alias found in your tsconfig.json file.
Visit https://ui.shadcn.com/docs/installation/vite to learn how to set an import alias.
System Info
- Operating System: Windows 11
- Node.js version: (v22.12.0)
- NPM version: (10.9.0)
Before submitting
- [x] I've made research efforts and searched the documentation
- [x] I've searched for existing issues
This is urgent @shadcn
Hi,
same issue for me!
macos 15.2 node v23.5.0 npm 11.0.0
if you are using js make sure adding jsconfig file in root folder with this content
{ "compilerOptions": { "baseUrl": ".", "paths": { "@/": ["./src/"] } } }
use this cmd
npm install -D [email protected] postcss autoprefixer
mention (@3.4.0)
Yes It works, but it will not solve the issue with tailwind 4
same issue
Just to be clear, this is just an issue with init and components that change the tailwind config (accordion, sidebar). You can quite easily have tailwind v4 running, create a tailwind.config.ts, and then run npx shadcn@latest init. Afterwards you will need to update the tailwind theme in global.css the way tailwind v4 now defines the config or add the config using @config "../../tailwind.config.js";
Check out the example repo for how the global.css should be setup: https://github.com/shadcn/app-tailwind-v4
same here
if you are using js make sure adding jsconfig file in root folder with this content
{ "compilerOptions": { "baseUrl": ".", "paths": { "@/": ["./src/"] } } }
it only debugs the import alias issue that is: No import alias found in your tsconfig.json file. Visit https://ui.shadcn.com/docs/installation/vite to learn how to set an import alias.
but the main issue is with the tailwind configuration.
I think a quick update is needed
@shadcn urgently sort out this issue
@shadcn update the issue
I'm a subscriber to the issue, so I can read all the messages, with all due respect, but the people who are screaming to fix this urgently, why don't you do your own fork/PR? That's the point of an opensource project, we're already lucky enough to have a community pushing this project to the max, I'm sure they're already looking at the problem, there's no point in pressing them anymore/disturbing them....
Give them time to fix the problem, don't forget that for most of them this is a project in addition to their main job.
I'm actively working on this. There's a bit of work here. We're currently in a transition phase where we need to support both React 18 + Tailwind v3 and React 19 + Tailwind v3, along with all possible combinations.
I've made some headway and will share an update soon.
In the meantime, here's how you can start using/testing Tailwind v4:
- Install Tailwind v3 and
npx shadcn init. - Add all components:
npx shadcn add --all. - Run the Tailwind upgrade:
npx @tailwindcss/upgrade@next.
This will upgrade all components and primitives to Tailwind v4.
Nice! @shadcn, Thank you.
For others, be more patient, it won't be one less version that will end your project, just follow the steps and be happy.
I'm a subscriber to the issue, so I can read all the messages, with all due respect, but the people who are screaming to fix this urgently, why don't you do your own fork/PR? That's the point of an opensource project, we're already lucky enough to have a community pushing this project to the max, I'm sure they're already looking at the problem, there's no point in pressing them anymore/disturbing them....
Give them time to fix the problem, don't forget that for most of them this is a project in addition to their main job.
Yes, the issue will be resolved by @shadcn itself, and we should wait. Spreading panic in this manner is not appropriate.
If anyone has problems with vite, it is necessary to have version 4 or 5. The command is the following:
npm create vite@5
I'm actively working on this. There's a bit of work here. We're currently in a transition phase where we need to support both React 18 + Tailwind v3 and React 19 + Tailwind v3, along with all possible combinations.
I've made some headway and will share an update soon.
In the meantime, here's how you can start using/testing Tailwind v4:
- Install Tailwind v3 and
npx shadcn init.- Add all components:
npx shadcn add --all.- Run the Tailwind upgrade:
npx @tailwindcss/upgrade@next.This will upgrade all components and primitives to Tailwind v4.
I tried this but for some reason the buttons become glitchy. When hovering over button cursor doesn't change to pointer
I've updated the cli to support Tailwind v4 and React 19. Please test and share your feedback in the following thread: https://github.com/shadcn-ui/ui/issues/6585
@shadcn close issue and thanks so much
I have used tailwind version 3.4.17 and that works for my vite + javascript project.
npm create vite@latestnpm install -D [email protected] postcss autoprefixernpx tailwindcss init -p- In
src/index.css, paste this:
@tailwind base;
@tailwind components;
@tailwind utilities;
-
Update ‘content’ of the tailwind.config.js with this:
content: ["./index.html", "./src/**/*.{ts,tsx,js,jsx}"], -
create a
jsconfig.jsonfile and paste this:
{
"files": [],
"references": [
{
"path": "./jsconfig.app.json"
}
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
- create a
jsconfig.app.jsonfile and paste this:
{
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
}
// ...
}
}
- Run this command:
npm install -D @types/node
- Replace
vite.config.jsfile with this code:
import path from "path"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
})
- Run the CLI:
npx shadcn@latest init
Oh my god YES, i'm facing this issue, hopefully we get the solution soon
Facing this issue in my Next.js project
i faced same probl in astro today (19/02/2025) i used pnpm dlx shadcn@canary init and it worked fine
`pnpm dlx shadcn@canary init Packages: +167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Progress: resolved 167, reused 165, downloaded 2, added 167, done ✔ Preflight checks. ✔ Verifying framework. Found Astro. ✔ Validating Tailwind CSS config. Found v4. ✔ Validating import alias. √ Which color would you like to use as the base color? » Neutral √ Would you like to use CSS variables for theming? ... no / yes ✔ Writing components.json. ✔ Checking registry. ✔ Updating src\styles\global.css ✔ Installing dependencies. ✔ Created 1 file:
- src\lib\utils.ts Success! Project initialization completed. You may now add components. `
The problem seems to be simple. I believe this Tailwind validation step looks for the following directives:
@tailwind base;
@tailwind components;
@tailwind utilities;
I simply created a file src/assets/index.css with the content above and ran the command pnpm dlx shadcn@latest init, and it worked just fine.
An update needs to be made in this validation step to also consider @import "tailwindcss";.
This should be fixed now. Is this still happening?
@shadcn it worked on a fresh new Hydrogen project, I just had to install tailwindcss manually because Hydrogen only have @tailwindcss/vite installed by default. There is an issue on their end about this: https://github.com/Shopify/hydrogen/issues/2557.
Maybe preflight messaging could be more specific about which validation failed, because I had to check preflight-init.ts source code to find the root cause.
This is the message that I got due to a missing dependency:
✔ Preflight checks.
✔ Verifying framework. Found Remix.
✖ Validating Tailwind CSS.
✔ Validating import alias.
No Tailwind CSS configuration found at /Users/ricardo/projects/personal/hydrogen-storefront.
It is likely you do not have Tailwind CSS installed or have an invalid configuration.
Install Tailwind CSS then try again.
Visit https://tailwindcss.com/docs/guides/remix to get started.
The problem seems to be simple. I believe this Tailwind validation step looks for the following directives:
@tailwind base; @tailwind components; @tailwind utilities;I simply created a file
src/assets/index.csswith the content above and ran the commandpnpm dlx shadcn@latest init, and it worked just fine.An update needs to be made in this validation step to also consider
@import "tailwindcss";.
I can confirm this works with
"next": "15.2.0",
"react": "^19.0.0",
and using pnpm
thanks @ericksousa !
This should be fixed now. Is this still happening?
@shadcn I faced exactly the same issue when using a blank starter from payloadCMS, the issue arrises because when installing pnpm dlx shadcn init it requires a global.css file. In this case payload uses style.css, so just adding global.css fixed for me.
This should be fixed now. Is this still happening?
@shadcn I faced exactly the same issue when using a blank starter from payloadCMS, the issue arrises because when installing
pnpm dlx shadcn initit requires a global.css file. In this case payload uses style.css, so just adding global.css fixed for me.
![]()
Run this: npx @tailwindcss/upgrade and then retry :)
