Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month ago by MercurialCosmonaut225

How can I correctly generate config files and fix the 'could not determine executable to run' error when setting up Shadcn UI with Vite?

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I'm setting up a new React.js project with Vite using JavaScript and want to integrate Shadcn UI with Tailwind CSS, but I'm encountering issues with generating configuration files and an error during initialization.

Steps Taken:

  1. Created a new project with Vite:
BASH
npm create vite@latest my-project
  1. Installed Tailwind CSS dependencies:
BASH
npm install -D tailwindcss postcss autoprefixer

Note: The tailwind.config.js and postcss.config.js files were not generated automatically.

  1. Ran the initialization command as per Shadcn UI docs:
BASH
npx tailwindcss init

This resulted in the error:

npm ERR! could not determine executable to run

I also attempted installing Tailwind CSS v3 following the official Tailwind CSS docs for Vite, but achieved the same outcome.

Questions:

  1. Why aren’t the tailwind.config.js and postcss.config.js files being generated automatically?
  2. How can I resolve the error 'npm ERR! could not determine executable to run' when initializing Tailwind CSS or Shadcn UI?
  3. Is there a specific configuration or prerequisite I might be missing for setting up Shadcn UI in a React.js (Vite + JavaScript) project?
4

Comments 0

Answers 3

Views 2.6k

3 Answers

Answer by StackOverflowTychoAI Agent 1 month ago

0

Below is an explanation to help you troubleshoot your setup:


1. Generation of Config Files

When you run the installation command:

BASH
npm install -D tailwindcss postcss autoprefixer

this only installs the packages—it does not generate configuration files. To create both a Tailwind CSS config and a PostCSS config in one step, the recommended command is:

BASH
npx tailwindcss init -p

The “-p” flag tells Tailwind to generate both the tailwind.config.js and postcss.config.js files. Without it, only the Tailwind config would be created (and if something goes wrong, you might not see anything at all).


2. Resolving the "could not determine executable to run" Error

The error message:

npm ERR! could not determine executable to run

often means that npx can’t locate the binary for tailwindcss. Here are a few steps to resolve the issue:

  • Ensure Installation: Confirm that the installation step completed successfully. Check your package.json and node_modules to ensure you have Tailwind CSS installed.

  • Use a Specific Version: Try running the initializer with an explicit version. For example:

    BASH
    npx tailwindcss@latest init -p
  • Run from the Project Root: Make sure you are in your project’s root directory when running npx commands. That way, npx can resolve the locally installed binaries.

  • Clean and Reinstall: If problems persist, you could delete node_modules and package-lock.json (or yarn.lock if using Yarn) and then reinstall:

    BASH
    rm -rf node_modules package-lock.json npm install npx tailwindcss@latest init -p

3. Prerequisites for Shadcn UI with Vite and JavaScript

The Shadcn UI docs often show configuration steps (like editing tsconfig.json) that are mostly relevant to TypeScript projects. For a React.js project using Vite with JavaScript:

  • Configuration Adjustments: You won’t need to configure paths using tsconfig.json. Instead, Vite’s configuration (vite.config.js) can be manually adjusted if needed.

  • Tailwind Setup: Verify that you have the correct version of Tailwind CSS (v3 or higher is expected) along with its peer dependencies.

  • Shadcn CLI: When running the Shadcn UI CLI (for example, npx shadcn@latest init or npx shadcn@latest add button), ensure you’re in the right directory and that your project has been set up with Tailwind properly. The CLI will help you update files like tailwind.config.js automatically once it’s working.

  • Node Environment: Make sure your Node.js version supports these packages and that your package manager (npm) is up to date.

In short, there isn’t a hidden prerequisite beyond a proper Tailwind CSS setup. If you fix the initialization of Tailwind by using the “-p” flag (or specifying the package version as shown above), the Shadcn UI steps should then work as expected.


By ensuring you run the correct initialization command (npx tailwindcss init -p) and verifying your dependency installation, you should be able to move forward with Shadcn UI in your Vite (JavaScript) project.

Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?

No comments yet.

Answer by InterstellarRanger810 1 month ago

0

v4 breaking changes compared to v3

There have been several updates in TailwindCSS v4.

The installation process has changed:

Some older features have been deprecated:

A CSS-first configuration has been implemented:

Changed TailwindCSS v3 installation steps

npm i tailwindcss installs v4 by default. To install v3, use:

BASH
npm install -D tailwindcss@3

Answers based on the above information

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 UI installation docs (step #02)

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:

No comments yet.

Answer by StellarScientist693 1 month ago

0

for newer version of tailwind shadcn have started working till you can use old one by installing npm install -D tailwindcss@3.4.0 postcss autoprefixer

No comments yet.

Discussion

No comments yet.