Nuxt Ui tailwind errors

Nuxt ui tailwind error
28 Replies
kapa.ai
kapa.ai2mo ago
Hi @ひめじまあけの / Chyser. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
ひめじまあけの / Chyser
@criting_
kapa.ai
kapa.ai2mo ago
---------------------- There are several types of errors and issues that can arise when using Nuxt UI with Tailwind CSS, as reflected in the knowledge sources: 1. Configuration and Layer Issues
When using Nuxt Layers or a monorepo setup, Tailwind CSS utilities or custom classes from a base layer may not be processed correctly in the consuming app. This can result in missing styles, especially for shared components. A common solution is to use the @source directive in your CSS to explicitly tell Tailwind to scan the relevant directories for class usage:
@import "tailwindcss";
@import "tw-animate-css";
@source "../../app/components/**/*";

@import "tailwindcss";
@import "tw-animate-css";
@source "../../app/components/**/*";

This ensures Tailwind picks up all classes used in shared components across layers or packages. Without this, utilities like bg-red-500 or responsive prefixes (lg:, md:) might not work as expected in the consuming app layer. This issue is sometimes related to the way Tailwind's Vite plugin processes files in layered or monorepo setups, not strictly a Nuxt UI bug, but a Tailwind configuration detail you need to be aware of Nuxt Layers not processing CSS correctly from base layer. 2. Migration to Tailwind CSS v4
Nuxt UI v3 uses Tailwind CSS v4, which introduces a CSS-first configuration approach. You now define your theme using the @theme directive in your CSS, rather than a JavaScript config. If you haven't migrated your configuration, you may encounter errors or unexpected behavior. Example:
@import "tailwindcss";
@import "@nuxt/ui";

@theme static {
--font-sans: 'Public Sans', sans-serif;
--color-green-500: #00C16A;
/* ... */
}

@import "tailwindcss";
@import "@nuxt/ui";

@theme static {
--font-sans: 'Public Sans', sans-serif;
--color-green-500: #00C16A;
/* ... */
}

Make sure to follow the official Tailwind CSS v4 upgrade guide and update your Nuxt UI and Tailwind setup accordingly Migration Guide. 3. Memory/Performance Issues
In some development environments, especially with frequent hot module reloads (HMR), you may encounter "JavaScript heap out of memory" errors. This is often due to the underlying build tools (like Vite) and not Nuxt UI or Tailwind directly, but it can be triggered by large or complex Tailwind setups, especially with many rapid file changes FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. 4. Color and Design System Changes
If you recently upgraded Nuxt UI, note that the design system has changed. For example, gray is now neutral, and you should use new color aliases in your classes and props. Using old color names or Tailwind color names directly in Nuxt UI component props will result in errors or ignored styles Changes from v2. If you are experiencing a specific error, please provide the error message or describe the issue in more detail for targeted troubleshooting. The knowledge sources do not mention a single, specific "Nuxt UI Tailwind error," but the above are the most common issues and solutions documented. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@237343644468772865> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
ひめじまあけの / Chyser
ERROR Pre-transform error: Can't resolve 'tailwindcss' in 'C:\Users\senem\MEM22\assets\css' 00:55:59
Plugin: @tailwindcss/vite:generate:serve File: C:/Users/senem/MEM22/assets/css/tailwind.css now is like this
criting_
criting_2mo ago
can you delete yout node modules folder, do pnpm/npm install and then npm/pnpm run dev
ひめじまあけの / Chyser
okay is nuxt/ui supporting tailwind 3 ?
criting_
criting_2mo ago
it is based on tailwdin 4 and you don't insta;; tailwind separeta
ひめじまあけの / Chyser
then i need upgrade it 😄
criting_
criting_2mo ago
tailwind is included in nuxt ui
ひめじまあけの / Chyser
but when i setup before installed base tailwind 3 my website after i install nuxt ui because of that its problem i think
criting_
criting_2mo ago
what do you mean
ひめじまあけの / Chyser
when i nuxt project start with tailwind 3 version now i installed nuxt/ui if its not supporting tailwind 3 that throw errors
criting_
criting_2mo ago
remove Twildincss all together and install Nuxt UI 3, it will install tailwdincss 4
ひめじまあけの / Chyser
its now install it im waiting
ひめじまあけの / Chyser
i remove it but its not install tailwind
No description
ひめじまあけの / Chyser
[01:11:38] ERROR Cannot start nuxt: It looks like you're trying to use tailwindcss directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install @tailwindcss/postcss and update your PostCSS configuration. at gn (/C:/Users/senem/MEM22/node_modules/tailwindcss/dist/chunk-4WXWQT6Y.mjs:35:2121) at resolveCSSOptions (/C:/Users/senem/MEM22/node_modules/@nuxt/vite-builder/dist/shared/vite-builder.CIHwkLR7.mjs:1146:34) at async bundle (/C:/Users/senem/MEM22/node_modules/@nuxt/vite-builder/dist/shared/vite-builder.CIHwkLR7.mjs:1428:14) at async bundle (/C:/Users/senem/MEM22/node_modules/nuxt/dist/shared/nuxt.CJ7ZnOUY.mjs:7417:5) at async build (/C:/Users/senem/MEM22/node_modules/nuxt/dist/shared/nuxt.CJ7ZnOUY.mjs:7277:3) at async Promise.all (index 1) at async NuxtDevServer._load (/C:/Users/senem/MEM22/node_modules/@nuxt/cli/dist/chunks/index.mjs:278:5) at async NuxtDevServer.load (/C:/Users/senem/MEM22/node_modules/@nuxt/cli/dist/chunks/index.mjs:170:7) at async NuxtDevServer.init (/C:/Users/senem/MEM22/node_modules/@nuxt/cli/dist/chunks/index.mjs:165:5) at async initialize (/C:/Users/senem/MEM22/node_modules/@nuxt/cli/dist/chunks/index.mjs:438:3)
criting_
criting_2mo ago
it does not install tailwindcss as a depencecy, becasue it is incluced in Nuxt in UIm you should not use it as a sstandlone library
ひめじまあけの / Chyser
modules: [ "@nuxtjs/tailwindcss", "@nuxtjs/i18n", "@nuxt/eslint", "@nuxt/ui", // "@nuxt/fonts", "@nuxt/icon", "@nuxt/image", "@nuxtjs/supabase", "@nuxtjs/sitemap", ], css: [ "~/assets/css/tailwind.css", "@vueup/vue-quill/dist/vue-quill.snow.css", "@/assets/css/fonts.css", ], postcss: { plugins: { "@tailwindcss/postcss": {}, // ✅ bu olmalı autoprefixer: {}, }, }, what can i do then
criting_
criting_2mo ago
remove the whole postcss and in your main.css just add @import "tailwindcss"; @import "@nuxt/ui";
ひめじまあけの / Chyser
//tailwind.config.ts import type { Config } from "tailwindcss"; const config: Config = { content: [ "./components//*.{vue,js,ts}", "./layouts//.vue", "./pages/**/.vue", "./composables//*.{js,ts}", "./plugins//*.{js,ts}", "./app.vue", "./nuxt.config.{js,ts}", ], theme: { extend: { fontFamily: { sans: ["'Fira Sans'", "sans-serif"], sora: ["Sora", "sans-serif"], }, colors: { primary: "#492FDD", lightGray: "#F5F5F5", darkGray: "#212121", midGray: "#949494", charcoal: "#262B2F", gold: "#FFD700", orange: "#FF6200", }, }, }, plugins: [require("@tailwindcss/typography")], }; export default config; then i will remove tailwind.config.ts ?
criting_
criting_2mo ago
yes
ひめじまあけの / Chyser
how can do this setup on nuxt/ui i dont know next ui, i know tailwind 😄
criting_
criting_2mo ago
using app.config.ts export default defineAppConfig({ ui: { colors: { primary: 'yellow', neutral: 'neutral' }, }, }); and using nuxt config as well fonts: { families: [ { name: 'Geist', provider: 'google', weights: ['400', '500', '600', '700', '800'] } ] }, main.css @theme static { --font-sans: 'Geist', sans-serif; --font-mono: 'Geist Mono', monospace; }
ひめじまあけの / Chyser
I'll go back to my turtle shell 😄 its confusing mind when i free time i will learn it with empty nuxt
ひめじまあけの / Chyser
deleting everythins 😄
No description
criting_
criting_2mo ago
that is a brave move 😄
ひめじまあけの / Chyser
i already github vercel setup 😄 website is online just my carousel is puff

Did you find this page helpful?