Problem -
I'm working on a React project based on Vite. I want to add Tailwind CSS, and after following the steps below, I'm encountering an error.
1. npm install -D tailwindcss postcss autoprefixer
Initialize Tailwind CSS
2. npx tailwindcss init -p
The first command executed without errors. However, the second command resulted in the following error:
npm error could not determine executable to run
npm error A complete log of this run can be found in: C:\Users\HelloWorld\AppData\Local\npm-cache\_logs\2025-02-14T17_30_29_652Z-debug-0.log
I tried by clear npm,
Clear npm Cache
It still didn't work. same error when run 2nd one.
Solution:
The installation of TailwindCSS v3 and v4 is different. You were expecting the v3 installation, but v4 is the new latest version. For v3 installation, use:
npm install -D tailwindcss@3
- Cannot build frontend with TailwindCSS - StackOverflow
However, if you want to install v4, I recommend reviewing the installation guides, as there are significant breaking changes between v3 and v4.
npm install tailwindcss @tailwindcss/vite
Comments
Post a Comment