Tailwind CSS v4: 'npx tailwindcss init' fails with 'could not determine executable to run'
Tailwind v4 has no init command and no tailwind.config.js by default. With Vite: npm install tailwindcss @tailwindcss/vite, add tailwindcss() to the plugins in vite.config, and put @import "tailwindcss"; at the top of your main CSS file. Theme customisation moves into CSS with @theme. Tutorials using the @tailwind base/components/utilities directives, postcss config and init are for v3; to follow them exactly, install tailwindcss@3.
Confirmed with tailwindcss 4.3.5 on npm 11 (
npm error could not determine executable to run; the package ships no CLI binary). The next error on the v3 path comes from the v3 postcss.config.js:[postcss] It looks like you're trying to usetailwindcssdirectly as a PostCSS plugin. The PostCSS plugin has moved to a separate package.... It kept failing even after @tailwindcss/vite was set up correctly, until postcss.config.js was deleted (or itstailwindcss: {}key changed to'@tailwindcss/postcss': {}).