ui: [bug]: New CLI astro installation instructions lead to No Tailwind error
Describe the bug
Followed exact instructions for astro new project creation. When I got to npx shadcn@latest init I received errors about not finding tailwind.
Affected component/components
CLI
How to reproduce
Follow astro installation instructions at https://ui.shadcn.com/docs/installation/astro
Codesandbox/StackBlitz link
No response
Logs
``✔ Preflight checks.
✔ Verifying framework. Found Astro.
✖ Validating Tailwind CSS.
✖ Validating import alias.
No Tailwind CSS configuration found at /home/username/HotWebsite.
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/astro to get started.
No import alias found in your tsconfig.json file.
Visit https://ui.shadcn.com/docs/installation/astro to learn how to set an import alias``
System Info
Ubuntu 22.04 LTS
node v18.17.1
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: 6
- Comments: 16
I was able to get around this by adding the standard tailwind config in global styles.
Both tailwind and shadcn docs indicate that you don’t need to configure a global styles.css for Astro but the cli seems to require both a tailwind.config and a global styles.css with the typical @tailwind directives.
from
packages/shadcn/src/preflights/preflight.init.tsMy temporary fix is adding those directives to your global styles.css
I have the same issue with React + Vite using SCSS and TypeScript. This is the error I am getting:
I had the same issue. Followed exact instructions on Astro docs. The problem was that for some reason, cli didn’t created
components.jsonfile during scaffolding. So, nocomponents.jsonfile at project root. Here’s basic Astro project setup that hastailwind,reactandshadcn.I am still unable to create a new project with Vite. Any updates?
I have same issue for Next.js
Hey Everyone,
Here is the Fix…At least using Vite + JS
Step01) Validate that you followed the instructions here: [https://ui.shadcn.com/docs/installation/vite]
** Note ** you only need to create a jsconfig.json file and paste:
{ “compilerOptions”: { // … “baseUrl”: “.”, “paths”: { “@/": [ "./src/” ] } // … } }
Step02) Update your tailwind.config.js:
/** @type {import(‘tailwindcss’).Config} / export default { content: [ “./index.html”, "./src/**/.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, plugins: [], }
Step03) go to index.css under src and paste this at the top of the file:
*** Note *** Not sure if this is necessary or not but worked for me
@tailwind base; @tailwind components; @tailwind utilities;
Hi, still having this issue with Vite React + TS, following all instructions at https://ui.shadcn.com/docs/installation/vite, the workaround with styles.css described in this thread helped.
I have the same issue with vanilla react and vite. Shadcn is not recognizing tailwindcss installation