I am trying to install the tailwind in react project but while creating tailwind.config.js file I am having this issue.
This is the error I am facing
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\PMLS\AppData\Local\npm-cache\_logs\2025-03-06T15_42_53_449Z-debug-0.log
I have cleared the cache and deleted the node_modules folder and npm install too. I have installed the latest version of Node.js, too, but it still doesn't work.
Maybe you are using v4 of Tailwind, which does not use init, but this instead:
npm install tailwindcss @tailwindcss/vite
https://tailwindcss.com/docs/installation/using-vite
Version 3.4 uses this:
npm install -D tailwindcss@3
npx tailwindcss init
https://v3.tailwindcss.com/docs/installation
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With