2

I installed Tailwind CSS in my project using:

npm install tailwindcss postcss autoprefixer

It installed successfully, and I can see it listed when I run:

npm list tailwindcss

[email protected] /home/jinx/cloud-project/frontend
└── [email protected]

However, when I try to check the version or initialize Tailwind, I get no output and no errors:

npx tailwindcss -v
npx tailwindcss init -p

I Tried:

  • Checking the node_modules/.bin directory

    ls -l node_modules/.bin | grep tailwindcss
    

    No tailwindcss binary found.

  • Reinstalling Tailwind CSS

    rm -rf node_modules package-lock.json  
    npm install tailwindcss postcss autoprefixer
    

    Still, the same issue.

  • Checking Node.js and npm versions

    node -v  # v20.18.3  
    npm -v   # 10.8.2  
    
  • Trying npx without installation

    npx --no-install tailwindcss -v
    

    No output.

  • Checking PATH issues

    When I run:

    echo $PATH
    

    I see that /bin:/usr/bin is missing, which might be causing ls and grep errors.

Expected Behavior:

npx tailwindcss -v  # should print the Tailwind CSS version.
npx tailwindcss init -p  # should generate a tailwind.config.js file.

Actual Behavior:

No output, no error messages.

What could be causing this issue, and how can I fix it?

1 Answer 1

2

TailwindCSS v3

The error is here:

npm install -D tailwindcss postcss autoprefixer

Since January 2025, the npm install tailwindcss command installs the new v4 version instead of the old v3. If you want to use TailwindCSS v3, follow:

npm install -D tailwindcss@3 postcss autoprefixer

Breaking changes from v4

The use of tailwind.config.js has been removed, and instead, you can use a simple CSS-first configuration. However, it's possible to use the legacy JavaScript-based configuration via the @config directive.

Additionally, the @tailwind directive has been deprecated since v4. Use

@import "tailwindcss";

instead.

In v4, the installation process has changed. It's now simpler. The init command has become obsolete and is no longer usable from v4 onwards because it's not needed anymore.

Other related breaking changes in v4:

TailwindCSS v4 with PostCSS

If you're interested in the new v4 version, review the many breaking changes and the new installation steps:

npm install tailwindcss @tailwindcss/postcss postcss

postcss.config.mjs

export default {
  plugins: {
    "@tailwindcss/postcss": {},
  }
}

app.css

@import "tailwindcss";

TailwindCSS v4 with CLI (without PostCSS)

Starting from v4, Vite, PostCSS, and CLI plugins have been split into 3 separate packages. It’s up to you which one you need. If you only need a clean TailwindCSS setup without Vite or PostCSS, you can use the CLI like this:

npm install tailwindcss @tailwindcss/cli

app.css

@import "tailwindcss";

The npx tailwindcss command is completely deprecated starting from v4, and instead, the npx @tailwindcss/cli command is used, like this:

npx @tailwindcss/cli -i ./src/input.css -o ./src/output.css --watch

PostCSS plugin and CLI are separate packages — the main tailwindcss package doesn't include these anymore since not everyone needs them, instead they should be installed separately using @tailwindcss/postcss and @tailwindcss/cli.


Source: Open-sourcing our progress on Tailwind CSS v4.0 - Whats changed

This is basically only necessary if you're not using it with a framework and want to run it from the command line. For this, a standalone @tailwindcss/cli package will help from v4 onwards.

But remember: the init process (which you mentioned in the question) has been removed starting from v4. There's no need for it, as tailwind.config.js is also no longer required in v4. Read more about the CSS-first configuration or v3 compatibility:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.