tailwind css - Can't install TailwindCSS 4 standalone - Stack Overflow

admin2025-04-16  9

Trying to install Tailwind 4.0 full standalone CLI following their own documentation here:

  • Standalone CLI: Use Tailwind CSS without Node.js - TailwindCSS Blog

I copy and paste the example for macOS arm64 as those apply to my hardware:

  • Download tailwindcss-macos-arm64 from v4.0.3 release - TailwindCSS Release - GitHub
chmod +x tailwindcss-macos-arm64
mv tailwindcss-macos-arm64 tailwindcss

So far so good. To get the config file I'm instructed to: ./tailwindcss init but I get:

Invalid command: init

What am I missing/doing wrong?

Trying to install Tailwind 4.0 full standalone CLI following their own documentation here:

  • Standalone CLI: Use Tailwind CSS without Node.js - TailwindCSS Blog

I copy and paste the example for macOS arm64 as those apply to my hardware:

  • Download tailwindcss-macos-arm64 from v4.0.3 release - TailwindCSS Release - GitHub
chmod +x tailwindcss-macos-arm64
mv tailwindcss-macos-arm64 tailwindcss

So far so good. To get the config file I'm instructed to: ./tailwindcss init but I get:

Invalid command: init

What am I missing/doing wrong?

Share Improve this question edited Feb 6 at 12:55 rozsazoltan 11.3k6 gold badges20 silver badges59 bronze badges asked Feb 3 at 0:37 MichaelMichael 1492 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The article you are referring to was written in 2021. TailwindCSS v4 only debuted this January 2025, so the article's content is outdated and was written for v3. Follow the new documentation; here are some important changes for you.

  • Get Started with Tailwind CLI TailwindCSS v4 Docs
  • Upgrade guide: Using Tailwind CLI - TailwindCSS v3 to v4
  • TailwindCSS v4 Alpha: Using the CLI - TailwindCSS v4-alpha release note

Deprecated init process

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.

  • tailwindlabs/tailwindcss #15791 - init process not available - GitHub
  • Problem installing TailwindCSS after "npx tailwindcss init -p" command - StackOverflow
  • How to upgrade TailwindCSS? - StackOverflow
  • Deprecated: preprocessors support - StackOverflow

Changed npx tailwindcss to npx @tailwindcss/cli

The command to run is now no longer npx tailwindcss but npx @tailwindcss/cli.

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.

npm install tailwindcss @tailwindcss/cli
转载请注明原文地址:http://anycun.com/QandA/1744782540a87556.html