Search code examples
reactjstailwind-csspostcssautoprefixer

'tailwindcss' is not recognized as an internal or external command


I have already pre installed tailwind css for my react library and added a script called build-css but run it, npm run build-css it gives me following error : 'tailwindcss' is not recognized as an internal or external command

package.json file

{
  "name": "react-firebase-authentication",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.0",
    "autoprefixer": "^9.8.8",
    "postcss": "^7.0.39",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-icons": "^4.3.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "build-css": "tailwindcss build src/styles.css -o public/styles.css",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

CMD Error CMD ss


Solution

  • Installing postcss-cli will help solves the problem.

    npm install -D postcss postcss-cli