I'm trying to set up Shadcn UI in a new React.js project using Vite with JavaScript, but I'm encountering some issues.
Steps Taken for Shadcn UI:
Created a new React.js project with Vite and selected JavaScript:
npm create vite@latest my-project
Ran the following command to install Tailwind CSS dependencies:
npm install -D tailwindcss postcss autoprefixer
However, the tailwind.config.js
and postcss.config.js files were not generated automatically.
npx tailwindcss init
But I encountered the following error:
npm ERR! could not determine executable to run
I also tried installing Tailwind CSS v3 using the official Tailwind CSS docs for Vite, but faced a similar issue. Here's what I did:
Ran the command:
npm install -D tailwindcss postcss autoprefixer
But again, the tailwind.config.js
and postcss.config.js
files were not generated as expected.
Ran the next command as instructed:
npx tailwindcss init
And encountered the same error:
npm ERR! could not determine executable to run.
Questions:
Why aren’t the tailwind.config.js and postcss.config.js files being generated automatically when running the installation commands?
How can I resolve the error npm ERR! could not determine executable to run
when initializing Tailwind CSS or Shadcn UI?
Is there a specific configuration or prerequisite I might be missing for setting up Shadcn UI in a React.js (Vite + JavaScript) project?
I'm trying to set up Shadcn UI in a new React.js project using Vite with JavaScript, but I'm encountering some issues.
Steps Taken for Shadcn UI:
Created a new React.js project with Vite and selected JavaScript:
npm create vite@latest my-project
Ran the following command to install Tailwind CSS dependencies:
npm install -D tailwindcss postcss autoprefixer
However, the tailwind.config.js
and postcss.config.js files were not generated automatically.
npx tailwindcss init
But I encountered the following error:
npm ERR! could not determine executable to run
I also tried installing Tailwind CSS v3 using the official Tailwind CSS docs for Vite, but faced a similar issue. Here's what I did:
Ran the command:
npm install -D tailwindcss postcss autoprefixer
But again, the tailwind.config.js
and postcss.config.js
files were not generated as expected.
Ran the next command as instructed:
npx tailwindcss init
And encountered the same error:
npm ERR! could not determine executable to run.
Questions:
Why aren’t the tailwind.config.js and postcss.config.js files being generated automatically when running the installation commands?
How can I resolve the error npm ERR! could not determine executable to run
when initializing Tailwind CSS or Shadcn UI?
Is there a specific configuration or prerequisite I might be missing for setting up Shadcn UI in a React.js (Vite + JavaScript) project?
Now, Shadcn officially started supporting TailwindCSS v4. See:
forwardRef
- Shadcn Upgrade Guideshadcn-ui/ui
#6585: Known issues - GitHubIf you're starting a new project with Tailwind v4 and React 19, use the canary version of the command-line:
npx shadcn@canary init
There have been several updates in TailwindCSS v4.
The installation process has changed:
Some older features have been deprecated:
npx tailwindcss
to npx @tailwindcss/cli
- TailwindCSS v4 Docsnpx tailwindcss init
process - StackOverflowA CSS-first configuration has been implemented:
tailwind.config.js
- TailwindCSS v4 Docs@config
directive to legacy JavaScript-config - StackOverflownpm i tailwindcss
installs v4 by default. To install v3, use:
npm install -D tailwindcss@3
Why aren't the tailwind.config.js and postcss.config.js files being generated automatically when running the installation commands?
The init process has been removed. There is no longer a need for tailwind.config.js
, so nothing is automatically created anymore. However, you can still make it available using the @config
directive and create it manually.
How can I resolve the error npm ERR! could not determine executable to run when initializing Tailwind CSS or Shadcn UI?
This error typically occurs when there is an issue with the command being run, such as a missing or incorrect executable. From the context, I infer that you're trying to run the init
process, but as I mentioned, it has been deprecated.
Is there a specific configuration or prerequisite I might be missing for setting up Shadcn UI in a React.js (Vite + JavaScript) project?
I think the difference between v3 and v4 is causing some confusion right now. If you go through these and cleanly install/migrate from your v3 project to the v4 version, everything should work afterward.
shadcn/app-tailwind-v4
- GitHubshadcn/ui
#2996 - GitHubtailwindcss@3
) must be added to the command, as npm install tailwindcss
now defaults to the latest version, which is v4. See: shadcn-ui/ui
#6632.The Shadcn UI installation with Vite guides are still based on TailwindCSS v3. You can either use them with npm install tailwindcss@3
or completely disregard them and follow the steps for TailwindCSS v4 instead:
shadcn-ui/ui
#6446: Not validating after Tailwind v4 update - GitHubshadcn-ui/ui
#6427: Upgrade to TailwindCSS v4 - GitHubshadcn-ui/ui
#6585: Tailwind v4 and React 19 - GitHubnpx
is not finding the correct executable in your project.
This is due to a version change in tailwindcss
.
It is because tailwind 4 has different way of installing you should use outdated version 3 version or follow tailwind new documentation to setup the whole way of working
for newer version of tailwind shadcn have started working till you can use old one by installing npm install -D [email protected] postcss autoprefixer
shadcn-ui/ui
#6427 and Shadcn UI with TailwindCSS v4 – rozsazoltan Commented Feb 10 at 17:56