16

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.

5

4 Answers 4

32

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

Sign up to request clarification or add additional context in comments.

3 Comments

i have manualy created tailwind.config.js file and postcss.config.js files in root folder and it works correctly as i researched on it and found that 'init' is no longer in npm
Yeah @UmerFarooq, this is a duplicate question with less refined answers than the original. Unfortunately, SO's duplicate closing process is pretty slow... Problem installing TailwindCSS with Vite, after "npx tailwindcss init -p" command (created Jan 2025) - Other related: What's breaking changes from v4? (created Jan 2025)
I almost finish my chatGpt Gemini and deepseek limits but couldnt find a solution. When I paste the error to Google I solve it in seconds thanks to you. AIs are stupid stackoverflow is smart :)
14

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

3 Comments

i get this dependency tree error when trying to use "npm install tailwindcss @tailwindcss/vite" : npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: [email protected] npm error Found: [email protected] npm error node_modules/vite npm error dev vite@"^7.0.0" from the root project npm error npm error Could not resolve dependency: npm error peer vite@"^5.2.0 || ^6" from @tailwindcss/[email protected] npm error node_modules/@tailwindcss/vite npm error @tailwindcss/vite@"*" from the root project npm error npm error Fix the ups
Yeah @UmerFarooq, this is a duplicate question with less refined answers than the original. Unfortunately, SO's duplicate closing process is pretty slow... Problem installing TailwindCSS after npx tailwindcss init command - 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)
0

even i got the same issue than found out the command ur using will only work for tailwind v3 not v4. so instead use v3 of taikwind and everything runs good. and the offical tailwind document for vite+react for tailwind is not there. So using tailwind v3 is better option i guess.

3 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
This is bad advice and a flawed conclusion. v3 is not deprecated, but recommending using v3 because of the problem is not a solution. The solution is that v4 doesn't require a tailwind.config.js, so there's no need to run init process either.
Consequently, the CLI is no longer needed in the main package, which is why it has been split into multiple packages. See the full answer: Problem installing TailwindCSS after npx tailwindcss init command - tailwindcss not recognized - NPM error could not determine executable to run (created Jan 2025) and Tailwind CSS v4: more packages and new Vite support
0

Tailwind Cli tool is working for me in v4 or backward to v3 https://tailwindcss.com/docs/installation/tailwind-cli

what code on docker

RUN apt-get update && apt install nodejs npm -y
RUN npm install tailwindcss @tailwindcss/cli
npx @tailwindcss/cli -i ./src/site.css -o ./src/output.css --watch

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.