question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PostCSS 8 requirement even with npm:@tailwindcss/postcss7-compat

See original GitHub issue

What version of Tailwind CSS are you using?

npm:@tailwindcss/postcss7-compat

What build tool (or framework if it abstracts the build tool) are you using?

N/A

What version of Node.js are you using?

14.17.1

What browser are you using?

N/A

What operating system are you using?

Windows

Reproduction repository

https://github.com/joshcomley/bugs-tailwindpostcss

Describe your issue

After following the guidelines on avoiding PostCSS plugin tailwindcss requires PostCSS 8., I still get the message.

Here is a simple repro where I am unable to compile tailwind at all in its most basic way, even with all the correct “compat” packages installed.

To see this in action:

  • Clone the repo
  • Install packages
  • Run yarn build:css

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
mpalmer685commented, Aug 4, 2021

I ran into this issue, too. Reverting to a version earlier than 2.2.0 does fix it.

If you need this, you can change the dependency in your package.json to: "tailwindcss": "npm:@tailwindcss/postcss7-compat@2.1.4"

2reactions
adamwathancommented, Sep 26, 2021

Hey! In this case there is no reason to use the PostCSS 7 build since you aren’t actually running PostCSS yourself. To get things building in your repo you have a few options:

  1. Just use the latest version. If you aren’t actually trying to integrate with an existing PostCSS pipeline, there’s no need to use the PostCSS 7 version:

      {
        "name": "twtest",
        "version": "1.0.0",
        "description": "",
        "main": "index.js",
        "scripts": {
          "build:css": "tailwind build -i src/index.css -o src/build.css",
          "test": "echo \"Error: no test specified\" && exit 1"
        },
        "author": "",
        "license": "ISC",
        "devDependencies": {
    -     "autoprefixer": "9",
    -     "postcss": "7",
    -     "tailwindcss": "npm:@tailwindcss/postcss7-compat"
    +     "tailwindcss": "^2"
        },
      }
    
  2. Integrate with PostCSS in a PostCSS 7 project. If you actually are integrating with PostCSS 7, things will work since you won’t be using our CLI. Here’s an example using postcss-cli, it works as expected:

      {
        "name": "twtest",
        "version": "1.0.0",
        "description": "",
        "main": "index.js",
        "scripts": {
    -     "build:css": "tailwind build -i src/index.css -o src/build.css",
    +     "build:css": "postcss src/index.css -o src/build.css",
          "test": "echo \"Error: no test specified\" && exit 1"
        },
        "author": "",
        "license": "ISC",
        "devDependencies": {
          "autoprefixer": "9",
          "postcss": "7",
    +     "postcss-cli": "^7",
          "tailwindcss": "npm:@tailwindcss/postcss7-compat"
        }
      }
    
    

I’ll make a note to consider replacing the CLI in the compat build with a simple script that just throws an error, since there’s no reason for our actual CLI tool to have a PostCSS 7 version.

We will be dropping PostCSS 7 support in November when Tailwind CSS v3 is release for what it’s worth, so hopefully the rest of the ecosystem (I think really just CRA) catches up by then. I’d recommend using Vite instead of CRA personally, does all the same stuff but is faster and more modern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: PostCSS plugin tailwindcss requires PostCSS 8
So I had to install with yarn instead and it works. npm uninstall tailwindcss postcss autoprefixer yarn add tailwindcss@npm:@tailwindcss/ ...
Read more >
@tailwindcss/postcss7-compat - npm
A utility-first CSS framework for rapidly building custom user interfaces.. Latest version: 2.2.17, last published: a year ago.
Read more >
Installation - Tailwind CSS
Error: PostCSS plugin tailwindcss requires PostCSS 8. In this case, you should install the PostCSS 7 compatibility build instead.
Read more >
React with Tailwind CSS - Product Engineering
Error: PostCSS plugin tailwindcss requires PostCSS 8. You can also use Tailwind CSS that supports the previous version. npm install -D tailwindcss@npm:@ ...
Read more >
postcss-import 13 & tailwindcss 2 - Laracasts
I have a repository with Laravel 8 and Tailwind CSS v2, one with the backward compatible version for PostCSS 7 and one for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found