Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sh: tailwindcss: command not found #4953

Unanswered
MrDavidson23 asked this question in Help
Discussion options

I'm trying to use TailwindCSS, but I can't

Everytime I put npx tailwindcss -o tailwind.css, the bash gives me a: sh: tailwindcss: command not found

The steps I follow are:

  1. Init nodejs: npm init
  2. Install tailwindcss:
    I have had use npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
    And also npm i -D tailwindcss
  3. Build tailwind:
    npx tailwindcss -o tailwind.css
    It gives me: sh: tailwindcss: command not found
You must be logged in to vote

Replies: 5 comments 15 replies

Comment options

Try to delete your node_module and reinstall all the package.

You must be logged in to vote
0 replies
Comment options

If your computer is MacOS, run brew install tailwindcss

You must be logged in to vote
4 replies
Comment options

thank you so much
it worked

Comment options

it worked too

Comment options

thanks a lot ,it worked

Comment options

Thanks it worked

Comment options

I thought tailwindcss was moved into @tailwindcss/cli.

https://tailwindcss.com/docs/installation/tailwind-cli

You must be logged in to vote
1 reply
Comment options

Comment options

npm install -D tailwindcss@3 postcss autoprefixer
npx tailwindcss init -p

It worked after running this command and add
@tailwind base;
@tailwind components;
@tailwind utilities;

in index.css

You must be logged in to vote
10 replies
Comment options

this works on macOS!

Comment options

It works like a charm after spending countless days debugging and going through the documentations. Thank you very much.

Comment options

thanks bro

Comment options

Comment options

OMG!!!
i swear after spending in hours debugging, i feel like you're an angel.

Comment options

Perhaps VERSION 3 is what you need

my initial setup was just React 19 in Webpack, and i'm not going to install tailwind globally

  1. install Tailwind CSS
npm install -D tailwindcss@3 postcss autoprefixer
npx tailwindcss init -p
  1. Configure your template paths

make sure your content lists where your template files are. for me it is on src and it should detect the .js, or .jsx files

/** @type {import('tailwindcss').Config} */
module.exports = {
 content: ["./src/**/*.{js,jsx}"],
 theme: {
 extend: {},
 },
 plugins: [],
};
  1. Add the Tailwind directives to your CSS

add these lines at the top of your index.css file

@tailwind base;
@tailwind components;
@tailwind utilities;
  1. Import the css file

my index.css was already imported within index.js

  1. start your build process
npm start
  1. Start using Tailwind in your project
export default function App() {
 return (
 <h1 className="text-3xl font-bold underline">
 Hello world!
 </h1>
 )
}
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /