Tailwind released version 4 in January of 2025 and the installation has changed quite a bit from the older version 3.x. This error is caused by the conflict in how version 3.x and version 4.x are installed.
C:\Users\Olusola\Documents\Portfolios\inperson\frontend>npx tailwindcss init
-p
npm error could not determine executable to run
npm error A complete log of this run can be found in:
C:\Users\Olusola\AppData\Local\npm-cache\_logs\2025-04-02T03_40_54_327Z-
debug-0.log
The command npx tailwindcss init -p works correctly for version 3.x. If you check the log file, you'll find leads as to what the issue might be. The most important lines are the following:
line 7 verbose title npm exec tailwindcss init -p
line 8 verbose argv "exec" "--" "tailwindcss" "init" "-p"
line 14 verbose stack Error: could not determine executable to run
line 15 verbose pkgid [email protected]
Note that the initial command npm -D tailwindcss postcss autoprefixer always installs the latest version of tailwindcss in your devDependencies in the package.json file. In my case, it is:
"devDependencies": {
...
"tailwindcss": "^4.1.0",
}
SUMMARY:
If you want to use version 3.x, use the following command:
npm install -D tailwindcss@3 postcss auto-prefixer
npx tailwindcss init -p
If you want version 4.x, use this command instead:
npm install tailwindcss @tailwindcss/vite
which npx- should give you the path if installednpx tailwindcss initcommand - tailwindcss not recognized - NPM error could not determine executable to run (created Jan 2025) - Other related: What's breaking changes from v4? (created Jan 2025)npx tailwindcss initcommand - tailwindcss not recognized - NPM error could not determine executable to run, but the close vote ended inconclusively.