I’m publishing this because I recently faced a frustrating tailwindcss installation error that wasted hours of my time. It turned out the problem was with how to install Tailwind CSS v4, and I don’t want anyone else to go through the same confusion. Let me walk you through what’s really happening.

Why the Old Command Isn’t Working

If you’ve been using TailwindCSS for a while, you’re probably used to running npx tailwindcss init when setting things up. The issue is that this command no longer works in the latest version. When you try it on Tailwind v4, you’ll likely see errors like:

Error: Unknown command init

That’s because the installation process has changed. To move forward, you’ll need to follow the new way to install Tailwind CSS v4.

The New Way to Install Tailwind CSS v4

Here’s how to do it right now:

  1. Run this command in your project: npm install tailwindcss @tailwindcss/vite
  2. Configure it with Vite (or your bundler of choice).
  3. Import Tailwind into your CSS: @import "tailwindcss";

That’s it! Your project is now running Tailwind v4 without errors.

What If You Still Want the Old Command?

If you’d rather keep things the old way, you can still install TailwindCSS v3 instead. In that version, the command npx tailwindcss init still works just fine.

But my recommendation? For new projects, always install Tailwind CSS v4. It’s faster, simpler, and the future of Tailwind.

Common Errors You Might See

When you try the old approach, here are some common problems:

  • Error: Unknown command init → because the CLI doesn’t support it in v4.
  • Config file not found → since v4 doesn’t auto-generate tailwind.config.js.

If you’re running into these, it’s almost certainly because you’re mixing the old method with the new version.

Read also: Understanding the ::before and ::after Pseudo-Elements in CSS

FAQ

1. Do I need a tailwind.config.js in v4?

No, Tailwind v4 works without it, though you can still create one if you want customization.

2. Can I downgrade to v3 to keep using the old command?

Yes, you can install TailwindCSS v3 and stick to the old CLI commands.

3. Should I upgrade my old projects to v4?

Not right away unless you’re ready. But for new projects, it’s best to install Tailwind CSS v4.

That’s it! Hopefully this clears up the tailwindcss installation error you’ve been running into. If you want to dive deeper, check the official docs here: TailwindCSS v4 Documentation.

If you need help setting up Tailwind, or if you’re looking for a team to build your project from scratch, the RaynerdTech team can help. React out to us here Contact Us or send us a message on WhatsApp.