0

I am following the official Tailwind CSS installation for reactjs tutorial step-by-step but tailwindcss is not being added on my reactjs project.

This is the link to the tutorial I am following,

I think the only part where I might have a mistake is the tailwind.config.js file and here it is.

module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}"
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

index.css

@tailwind base;
@tailwind components;
@tailwind utilities;

postcss.config.js

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}
MarioG8
  • 5,122
  • 4
  • 13
  • 29
  • Please share your index.css file and the output you see when running ```npm run start```. – tomerpacific Jan 06 '22 at 18:29
  • @tomerpacific just added index.css to the main post and when I run `npm run start` I do not get any error, just the regular messages. – Clayton Crockville Jan 06 '22 at 18:33
  • tailwind documentation on reactjs does not have anything on postcss.config.js, this file on my project is empty. – Clayton Crockville Jan 06 '22 at 18:37
  • Are you using CRA version 5 and did you restart CRA after the changes were made? – Sean W Jan 06 '22 at 18:40
  • I just updated it to version 5 and now get the error of `Error: Cannot find module 'workbox-build/build/options/schema/webpack-generate-sw'` even after I install the webpack thing still same error – Clayton Crockville Jan 06 '22 at 18:48
  • How do I initiate installations of your project? Could you show us the pacakge.json and folder&file structure of your project ? – MarioG8 Jan 07 '22 at 09:32
  • Could you provide Your code snippet with how you use tailwindcss in your react app ? – MarioG8 Jan 07 '22 at 09:38

1 Answers1

0

Try this...

  1. Update your react-scripts package v4 to v5 via npm install react-scripts@latest or yarn add react-scripts@latest

  2. Stop your React app and run again