-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
-
v4.0.1 -v4.0.3 (compatible with prev versions e.g. 3.)
NUXT 3.15.2
Node v20.12.2
@nuxtjs/tailwindcss: "^6.13.1",
I am not sure If issue refers to tailwind, I just downgraded to 3.4.17 and don't see message below anymore:
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.
Yes, I tried to install plugin and update postcss, it's just not the way it gotta work and indeed it doesn't. If anyone interested please take a better look than I did. :)
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 12 comments 11 replies
-
Hey!
Looks like you are configuring tailwindcss
as a PostCSS plugin instead of @tailwindcss/postcss
somewhere. Can you share a minimal reproduction repo so we can take a look?
Also make sure you follow all the steps described here: https://tailwindcss.com/docs/installation/framework-guides/nuxt
Beta Was this translation helpful? Give feedback.
All reactions
-
I am also having this issue right now.
Nuxt 3.15.0 with Nitro 2.10.4 nuxi 5:24:19 PM
[5:24:20 PM] ERROR 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
Beta Was this translation helpful? Give feedback.
All reactions
-
Getting a similar error now after running
yarn add tailwindcss postcss autoprefixer
Beta Was this translation helpful? Give feedback.
All reactions
-
Temporary fix was for me just resetting my package.json to
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12"
Obviously this is temporary and not a direct fix but should allow you to continue working.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 5
-
it work~~thank you😭
Beta Was this translation helpful? Give feedback.
All reactions
-
This works for me!!!
Beta Was this translation helpful? Give feedback.
All reactions
-
worked for me! thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions
-
while any other answer in this thread doesn't work, this alternative "unlocks" the project so I can continue developing but in the other hand I still gets this message here:
terminal output:
[14:54:35] ERROR Pre-transform error: Can't resolve 'tailwindcss' in '/home/gabrielm/work/eldorado-prime-admin-web-v2/assets/css'
Plugin: @tailwindcss/vite:generate:serve
File: /home/gabrielm/work/eldorado-prime-admin-web-v2/assets/css/main.css
assets/css/main.css:
@import "tailwindcss";
package.json dependencies:
"dependencies": {
"@tailwindcss/postcss": "^4.1.6",
"@tailwindcss/vite": "^4.1.6",
"autoprefixer": "^10.4.21",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-vue-next": "^0.510.0",
"nuxt": "^3.17.3",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12",
"shadcn-nuxt": "^2.1.0",
"tailwind-merge": "^3.3.0",
"tw-animate-css": "^1.2.9",
"vue": "^3.5.13",
"vue-router": "^4.5.1"
},
postcss.config.js:
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
},
}
tailwind.config.js:
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./components/**/*.{js,vue,ts}",
"./layouts/**/*.vue",
"./pages/**/*.vue",
"./plugins/**/*.{js,ts}",
"./app.vue",
],
theme: {
extend: {},
},
plugins: [],
}
➜ ✗ node -v
v22.14.0
➜ ✗ npm -v
10.9.2
Beta Was this translation helpful? Give feedback.
All reactions
-
@gabriel-mazieri727 you are using "@tailwindcss/postcss": "^4.1.6"
which is for Tailwind CSS v4, but you also have "tailwindcss": "^3.4.12",
installed which is Tailwind CSS v3.
Make sure you are using the correct versions everywhere.
Beta Was this translation helpful? Give feedback.
All reactions
-
Same issue here
[nuxi 11:21:53 AM] ERROR Cannot restart 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 Xr (node_modules/tailwindcss/dist/lib.mjs:24:1715)
at resolveCSSOptions (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.Cj8nWFwN.mjs:1136:34)
at async bundle (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.Cj8nWFwN.mjs:1392:14)
at async bundle (node_modules/nuxt/dist/shared/nuxt.CrJjphBv.mjs:6793:5)
at async build (node_modules/nuxt/dist/shared/nuxt.CrJjphBv.mjs:6644:3)
at async Promise.all (index 1)
at async NuxtDevServer._load (node_modules/@nuxt/cli/dist/chunks/dev2.mjs:206:5)
at async NuxtDevServer.load (node_modules/@nuxt/cli/dist/chunks/dev2.mjs:93:7)
at async _applyPromised (node_modules/perfect-debounce/dist/index.mjs:54:10)
Beta Was this translation helpful? Give feedback.
All reactions
-
If you guys are using nuxt, id recommend just to use the
"@nuxtjs/tailwindcss": "^6.13.1",
Package, this one comes with everything preconfigured
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Does this include Tailwind 4? edit No it does not
Beta Was this translation helpful? Give feedback.
All reactions
-
👎 5
-
to ensure that tailwind work... I think that if we are already using nuxt 3 we need to stick still with tailwind version 3 stuff and avoid manuall installations, so the things I do, to clear out the errors of tailwind and nuxt were:
- Avoided manual installation of Tailwind CSS(nuxt 3 already includes postcss and so... its unnecessary)
- ensured a Tailwind CSS version 3 structure
tailwind base; @tailwind components; @tailwind utilities;
3.Configured Tailwind within nuxt.config.ts and removed conflict configuration
export default defineNuxtConfig({ compatibilityDate: '2024-11-01', devtools: { enabled: true }, postcss: { plugins: { tailwindcss: {}, autoprefixer: {}, } }, css: ['~/assets/css/tailwind.css'], ...
hope it helps. I also reviewed and commented on similar errors I noticed when manually implementing Tailwind installation on the following git discussion
Beta Was this translation helpful? Give feedback.
All reactions
-
👎 1
-
I had installed @nuxt/ui
as nuxt module. I then installed @nuxtjs/tailwindcss
(as a nuxt module) not knowing that the nuxt/ui already included tailwindcss.
and gave the error
ERROR Cannot start nuxt: It looks like you're trying to use tailwindcss directly as a PostCSS plugin...
Removing the @nuxtjs/tailwindcss
nuxt module got rid of the error and tailwindcss worked as expected.
Hope this help for anyone in similar situation 😏
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 6 -
🎉 12 -
❤️ 17 -
🚀 3
-
Thanks! I'm going through a Udemy course, and your recommendation fixed this issue for me. Cheers!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
Keep in mind that you can't use both @nuxt/ui
and shadcn-nuxt
together.
If you have both installed, remove @nuxt/ui
from your dependencies (using npm, yarn, or any other package manager) and also remove its mention from the modules
section in nuxt.config.ts
.
Beta Was this translation helpful? Give feedback.
All reactions
-
Is there really no other way?
Beta Was this translation helpful? Give feedback.
All reactions
-
i tried multiply approaches and even tho the watcher runs without errors it doesn't seem like tailwind classes are working.
package.json
"@nuxt/eslint": "1.3.0",
"@storyblok/nuxt": "6.2.4",
"@tailwindcss/vite": "4.1.4",
"eslint": "9.25.1",
"eslint-config-prettier": "10.1.2",
"nuxt": "3.17.1",
"prettier": "3.5.3",
"tailwindcss": "4.1.4",
"typescript": "5.8.3",
"vue": "3.5.13"
nuxt.config.ts
import tailwindcss from '@tailwindcss/vite';
css: ['~projectAlias/assets/css/app.css'],
vite: {
plugins: [tailwindcss()],
},
app.css
@import 'tailwindcss';
template.vue
<template>
<h1 class="text-3xl font-bold underline text-[#50d71e]">Hello world!</h1>
<div class="bg-mint-500">Cyan?</div>
</template>
-> does absolutely nothing.
I do not have a tailwind.config but i assumed it would use a default one, plus i tried adding one but also without any difference.
I tried looking at it with ChatGPT but it absolutely insists that the approach with the vite package is wrong even tho it is what the documentation does.
Beta Was this translation helpful? Give feedback.
All reactions
-
i got it to work with Tailwind 4!! What seems so have been missing was @import 'tailwindcss' source(none);
in my app.css (packages/project-app/assets/css/app.css).
I could then refer to the project folders with @source './../../../project-app';
Beta Was this translation helpful? Give feedback.
All reactions
-
Related:
Beta Was this translation helpful? Give feedback.
All reactions
-
I was blocking with the same error.
After few research, it appears that my tailwind.config.js
was in the old format after generating it.
// Wrong old format
module.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
I've done this and it now works like a charms:
// New format
/** @type {import('tailwindcss').Config} */
export default {
content: [
'./components/**/*.{vue,js,ts}',
'./layouts/**/*.vue',
'./pages/**/*.vue',
'./app.vue',
'./plugins/**/*.{js,ts}',
],
theme: {
extend: {},
},
plugins: [],
}
I hope it can help !
Beta Was this translation helpful? Give feedback.