Tailwindcss V4 changed npx tailwindcss to npx @tailwindcss/cli
TailwindCSS v4
when I use the second command npx tailwindcss init -p, it gives me:
NPM error could not determine executable to run
TailwindCSS has just released its new v4 version, so all the older v3 documentation has become somewhat outdated.
- Upgrade guide - TailwindCSS v3 to v4
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.
1 | npm install tailwindcss @tailwindcss/cli |
- Get started with Tailwind CSS - TailwindCSS v4 Docs
- TailwindCSS v4 Alpha: Using the CLI
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.
Using the upgrade tool
If you’d like to try upgrading a project from v3 to v4, you can use our upgrade tool to do the vast majority of the heavy lifting for you:
1
2 npx @tailwindcss/upgrade@next
- How to using the upgrade tool - Tailwind CSS v4 Docs
- Unable to upgrade Tailwind CSS v3 to v4 - Related: an interesting fact about this
TailwindCSS v3
For a installation, you’ll already be installing v4. However, if you want to install v3, use the old documentation with the following command:
1 | npm install tailwindcss@3 |
- Get started - TailwindCSS v3 Docs
- Cannot build frontend using Vite, TailwindCSS with PostCSS - StackOverflow