122

I installed the new Tailwindcss version v2 and I've got the following error. I tried to uninstall PostCSS and TailwindCSS but it does not work.

error  in ./src/components/util/SlideInfo.vue?vue&type=style&index=0&lang=css&

Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: PostCSS plugin tailwindcss requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/Users/niklas/Desktop/Privat/Projekte/nifoschool-frontend/node_modules/postcss-loader/node_modules/postcss/lib/processor.js:153:15)
    at new Processor (/Users/niklas/Desktop/Privat/Projekte/nifoschool-frontend/node_modules/postcss-loader/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/Users/niklas/Desktop/Privat/Projekte/nifoschool-frontend/node_modules/postcss-loader/node_modules/postcss/lib/postcss.js:55:10)
    at /Users/niklas/Desktop/Privat/Projekte/nifoschool-frontend/node_modules/postcss-loader/src/index.js:140:12

 @ ./node_modules/vue-style-loader??ref--6-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/util/SlideInfo.vue?vue&type=style&index=0&lang=css& 4:14-393 14:3-18:5 15:22-401
 @ ./src/components/util/SlideInfo.vue?vue&type=style&index=0&lang=css&
 @ ./src/components/util/SlideInfo.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Grades.vue?vue&type=script&lang=js&
 @ ./src/views/Grades.vue?vue&type=script&lang=js&
 @ ./src/views/Grades.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://172.20.12.3:8081&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

Here is my package.json

  "name": "nifo-school",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "electron:build": "vue-cli-service electron:build",
    "electron:serve": "vue-cli-service electron:serve",
    "postinstall": "electron-builder install-app-deps",
    "postuninstall": "electron-builder install-app-deps"
  },
  "main": "background.js",
  "dependencies": {
    "react": "^16.3.0",
    "@ivanv/vue-collapse-transition": "^0.2.1",
    "autoprefixer": "^10.0.2",
    "axios": "^0.21.0",
    "core-js": "^3.6.5",
    "electron": "^8.0.0",
    "electron-drag": "^2.0.0",
    "jquery": "^3.5.1",
    "js-cookie": "^2.2.1",
    "postcss-cli": "^=8.0",
    "react-collapse": "^5.0.1",
    "summernote": "^0.8.18",
    "tailwindcss": "^2.0.1",
    "v-click-outside": "^3.1.2",
    "vue": "^2.6.11",
    "vue-html-editor": "^0.2.1",
    "vue-i18n": "^8.22.1",
    "vue-router": "^3.2.0",
    "vue2-editor": "^2.10.2",
    "vuex": "^3.5.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/eslint-config-airbnb": "^5.0.2",
    "babel-eslint": "^10.1.0",
    "electron-devtools-installer": "^3.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-vue": "^6.2.2",
    "lint-staged": "^9.5.0",
    "node-sass": "^4.12.0",
    "postcss": "^=8.1",
    "sass-loader": "^8.0.2",
    "vue-cli-plugin-electron-builder": "~2.0.0-rc.4",
    "vue-template-compiler": "^2.6.11"
  },
  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,vue}": [
      "vue-cli-service lint",
      "git add"
    ]
  }
}

Thanks for help

1

26 Answers 26

95

You're integrating Tailwind with a tool that relies on an older version of PostCSS. You can use this doc https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

Sign up to request clarification or add additional context in comments.

7 Comments

Vue 3 is one thing that does not yet have postcss 8 support. The guide above works great without hassle.
I get the following errors: npm ERR! ERESOLVE unable to resolve dependency tree,npm ERR! Found: [email protected] Any help?
I'm using Vue 3.0.7, which should have support for PostCSS 8, but I still get this error. My package-lock.json shows that the PostCSS is at v8.2.7, and I can't install the compat build because it conflicts with the PostCSS 8 requirement in @vue/compiler-sfc 3.0.7.
I'm using Vue2, and this workaround doesn't work.
that link seems to pointer no longer to anything related to compatibility anymore.
|
72
npm uninstall tailwindcss postcss autoprefixer

then

vue add tailwind 

to use the vue cli plugin https://www.npmjs.com/package/vue-cli-plugin-tailwind

4 Comments

Confirmed working with latest Vue3 + Typescript.
Great for those using vue cli. I used vite procedure that was why I got that error.
This doesn't work for me. I'm getting Cannot find module postcss-import
@The-null-Pointer- I had the same error trying this solution. I Had to let the command generate a new tailwind.config.js, although I already had one. Then it worked.
69

worked for me :

npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

5 Comments

I get the following errors: npm ERR! ERESOLVE unable to resolve dependency tree,npm ERR! Found: [email protected] Any help?
thanks ,,, this is a live saver ,, fixed my issue with laravel breeze installation
A thread on Tailwind's GitHub (sorry, no link) suggests each ^ may need to be escaped with an \ before each instance of ^
Legend. I ran npm uninstall tailwindcss postcss autoprefixer first but this sorted it for me. Build was successful. Thanks a bunch!
Works well with Vue3 + TS
37

This solution below should work perfectly.

Run the following commands. Remove the -D from the npm uninstall command if you originally installed tailwind etc as regular dependencies rather than dev dependencies.

npm uninstall -D tailwindcss postcss autoprefixer

npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat  postcss@^7 autoprefixer@^9

4 Comments

The second line errors out with Error code E404... I'll edit your post to properly reflect what it should be, In future though, Be more explanative in your answers
It's a good idea to install these with --save-dev or -D since they're only dev dependencies.
Second line - npm ERR! Cannot read property 'name' of null
The second line has an extra @tailwindcss/postcss7-compat that causes the problem. I'll edit the answer to remove it.
15

Uninstall Tailwind and re-install using the compatibility build instead

npm uninstall tailwindcss postcss autoprefixer
npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

2 Comments

they need to fix this thing soon. I ecnounter the same when I was trying to use it last week with vue cli project and today with parcelJS project. Thank you
A thread on Tailwind's GitHub (sorry, no link) suggests each ^ may need to be escaped with an \ before each instance of ^
14

I was getting dependency tree error when I try uninstall and install with compact version. So I had to install with yarn instead and it works.

npm uninstall tailwindcss postcss autoprefixer
yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

1 Comment

For yarn 2, yarn add tailwindcss@npm:@tailwindcss/postcss7-compat@^2.0.2 postcss@^7 autoprefixer@^9
13

The accepted answer is now out of date.

As of v2.0, Tailwind CSS depends on PostCSS 8. The previously accepted answer states how to downgrade to PostCSS 8

Instead please do the following to get everything running on all the latest versions

yarn add @storybook/addon-postcss

Then edit your .storybook/main.js

module.exports = {
  stories: [
    "../stories/**/*.stories.mdx",
    "../stories/**/*.stories.@(js|jsx|ts|tsx)",
  ],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    {
      name: "@storybook/addon-postcss",
      options: {
        postcssLoaderOptions: {
          implementation: require("postcss"),
        },
      },
    },
  ],
};

https://storybook.js.org/addons/@storybook/addon-postcss

@dlporter98

2 Comments

You need storybook for tailwind?
Not everyone is running storybook who's seeing this error (i'm one of them)....
12

you have to uninstall all these

npm uninstall autoprefixer postcss tailwindcss

Then run this command, it's will generate tailwind.css file automatically

vue add tailwind 

1 Comment

If you run into issues, you may need to use our PostCSS 7 compatibility build instead. tailwindcss.com/docs/…
9

With Vue 3 and Tailwindcss 3

  1. Create tailwind.config.js
  2. Create postcss.config.js
  3. Add following in postcss.config.js
module.exports = {
  plugins: {
    tailwindcss: {
      config: './tailwind.config.js'
    }
  }
}

The above configuration works fine with latest postcss, autoprefixer, vue 3 and tailwind 3

Comments

7

To resolve this error, uninstall Tailwind and re-install using the compatibility build instead:

npm uninstall tailwindcss postcss autoprefixer

npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Solution from Tailwind documentation v2

3 Comments

Does this fix the issue and allow for Tailwind 3?
It is getting ridiculous. 2022, and it is still kind of broken?
There is no need to downgrade to PostCSS 7, you can now easily get this working with PostCSS 8 - see stackoverflow.com/a/68605148/840897
5

The above solution fixed TaildWindCss PostCss issue, but I faced another error, which is :

TypeError: getProcessedPlugins is not a function

The Solution for is to upgrade Node version, in my case I upgraded from v10 to v15 which fixed my issue.

Comments

4

Oddly I had this issue on one dev machine . . . but not the other, with identical package.json file, and using identical node/npm (15.5/7.3). I deleted node_modules, reinstalled. Did not fix it.

Final fix, which is bizarre, is after the node module reinstall, all I did was:

npm uninstall tailwindcss

then

npm i tailwindcss --save-dev

(note, not using the compatibility package) and it worked fine. I do have to use --legacy-peer-deps when re-installing the node_modules, so somehow the order of installation mattered in my scenario . . .

1 Comment

What exactly did we do with this? I don't understand.
3

I got the same issue using laravel 8, So Try uninstalling tailwind using "npm uninstall tailwindcss" and install it back using

npm install tailwindcss@compat

then run "npx tailwindcss init" if you don't have the tailwing.config.js file

after then run npm run watch.

still follow up the laravel documentation for more when you get stuck https://laravel.com/docs/8.x/mix#tailwindcss

1 Comment

This did not work for me on laravel 8, however this did: tailwindcss.com/docs/…
3

For those upgrading to Tailwind 3, and experiencing this issue, the following instructions from Tailwind's own troubleshooting are what fixed it for me.

Specifically, changing your start and build scripts:

"start": "concurrently \"npm run start:css\" \"react-scripts start\"",
"start:css": "tailwindcss -o src/tailwind.css --watch",
"build": "tsc && npm run build:css && react-scripts build",
"build:css": "NODE_ENV=production tailwindcss -o src/tailwind.css -m",

You'll have to install concurrently and npm-run-all, though.

The following is my postcss.config.js:

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

This will mean that you'll have to import tailwind.css instead of index.css in your index file index.{tsx,js} for the project.

And if this worked for you, keep in mind you might no longer need @craco/craco installed.

1 Comment

Yes this worked for me. thanks. also need to follow this steps if setup was done using postCSS previously. Right now need to use tailwindCLI to do the setup. Note that Tailwind CSS v3.0 requires PostCSS 8, and no longer supports PostCSS 7. If you can’t upgrade to PostCSS 8, we recommend using Tailwind CLI instead of installing Tailwind as a PostCSS plugin. tailwindcss.com/docs/upgrade-guide tailwindcss.com/docs/installation
2

I'm on a Mac using VueJS 3 (@vue/cli 4.5.11). For me the following two commands solved the issue:

npm uninstall tailwindcss postcss autoprefixer
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest

This installed:

  • tailwindcss 2.1.1
  • postcss 8.2.10
  • autoprefixer 10.2.5

1 Comment

The tailwindcss@latest is incorrect. It installs v4, but you need to use v2 for your guide: npm install tailwindcss@2.
2

This worked for me: running "npm install tailwindcss postcss" and "npm install tailwindcss autoprefixer"

this seperates installation of postcss and autoprefixer independently.

1 Comment

The tailwindcss@latest is incorrect. It installs v4, but you need to use v3 for your guide: npm install tailwindcss@3.
1

I tried everything and was still having TypeError: getProcessedPlugins is not a function error. What fixed the issue for me was upgrading the nodejs version.

To check the installed node version

node -v

my node version was v10.23.0 and was using Ubuntu. I upgraded to v14.15.4.

Here is how I upgraded node

sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt-get install -y nodejs
node -v

also I cleaned the cache to be more sure

npm cache clean -f

After upgrading I deleted node_modules folder inside project. ran npm install and then ran npm run dev inside the project folder.

This is the only solution that worked for me, so sharing it.

Comments

1

I also faced this issue while upgrading. previously I done the setup using postCSS.

official documentation says

Note that Tailwind CSS v3.0 requires PostCSS 8, and no longer supports PostCSS 7. If you can’t upgrade to PostCSS 8, we recommend using Tailwind CLI instead of installing Tailwind as a PostCSS plugin.

So this time i done the setup using cli. https://tailwindcss.com/docs/installation

  1. yarn remove tailwindcss postcss autoprefixer
    yarn add --dev tailwindcss@latest @tailwindcss/typography@latest @tailwindcss/forms@latest @tailwindcss/aspect-ratio@latest @tailwindcss/line-clamp@latest postcss@latest autoprefixer@latest

  2. npx tailwindcss -i ./src/assets/css/style.css -o ./src/assets/css/tailwind.css --watch

And in package.json need to do this change

https://tailwindcss.com/docs/content-configuration#it-just-isn-t-working-properly

my package.json

"start": "concurrently \"npm run start:css\" \"react-scripts start\"",
"start:css": "tailwindcss -o src/assets/css/tailwind.css --watch",
"build": "tsc && npm run build:css && react-scripts build",
"build:css": "NODE_ENV=production tailwindcss -o src/assets/css/tailwind.css -m",

This answer helped me to resolve the issue https://stackoverflow.com/a/70492649/7225816

1 Comment

The tailwindcss@latest is incorrect. It installs v4, but you need to use v3 for your guide: npm install tailwindcss@3.
1

Yarn equivalent for those who are stuck with PostCSS v8 due to using a framework like Vuepress v1:

yarn add -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Comments

1
npm install tailwindcss@latest postcss@latest autoprefixer@latest

1 Comment

The tailwindcss@latest is incorrect. It installs v4, but you need to use v3 for your guide: npm install tailwindcss@3.
0

Had the same issue and did the following to resolve;

  1. Check your npm version using npm -ver, and make sure to install the latest version
  2. Also check your Node version and update to the latest version through this URL: "https://nodejs.org/en/download/"

Comments

0

While not using Vue, I hope this helps others with a similar issue. In my case, I was using TailwindCSS with Gulp (^4.0.2) and was able to solve the error by removing tailwind and its dependencies:

npm uninstall tailwindcss gulp-postcss autoprefixer

Then installed them again but explicitly specified the postcss plugin as version 9:

npm install tailwindcss autoprefixer gulp-postcss@9

I tried with gulp-postcss@latest, but found it kept installing version 8.3.1 and didn't resolve the error. More information can be seen here: https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users

Otherwise, I would echo the use of the Tailwind compatibility version.

1 Comment

The tailwindcss is incorrect. It installs v4, but you need to use v3 for your guide: npm install tailwindcss@3.
0

Posting my solution in case someone has exhausted all the other answers mentioned here. I removed the tailwind.config.js file and re-created it with npm tailwindcss init and re-applied my modifications. Solved the issue for me!

Comments

0

From Tailwind CSS v4 onwards

Starting from v4, the TailwindCSS package has separated the PostCSS and CLI modules - which are not needed by everyone - into dedicated packages: @tailwindcss/postcss and @tailwindcss/cli.

For installation, @tailwindcss/postcss is required from v4 onwards, which in tested with PostCSS v8.4.

Conclusion: From v4 onwards, using PostCSS 8.x is a minimum requirement.

npm install tailwindcss @tailwindcss/postcss postcss

Comments

0

Simply changing "postcss": "7.0.39" to "postcss": "8" in package.json file and than Doing a npm install fixed it for me .

Comments

-3
npm uninstall tailwindcss
npm install -D tailwindcss@3 postcss@latest autoprefixer@latest

6 Comments

The tailwindcss@latest is incorrect. It installs v4, but you need to use v3 for your guide: npm install tailwindcss@3.
@rozsazoltan Did you see when the comment was written? It was correct at the time he posted it
Of course, yes, that's why I commented. Since this answer will be outdated from January 2025. Even though you wrote it in 2022, I wanted to be nice and give you a chance to update it if possible. Besides, you didn’t add any extra text, and this answer can be found in multiple comments. From January 2025, this answer will lead to incorrect results, even if it was a "good" answer until then.
I believe keeping answers up to date is important. Everyone who reads your answer and tries it out in frustration will realize that "it doesn't work", even if it "worked" before. This makes the answer pointless moving forward unless you provide an explanation and an update.
If you're only concerned about the downvote, I didn't give it. Though, answers without explanations usually attract a lot of downvotes - not because they're bad, but simply because "the answer isn't very useful". After all, you don't explain why it's good, what it does, or how it works...
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.