'tailwindcss' 未被识别为内部或外部命令

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

我已经为我的 React 库预安装了 tailwind css 并添加了一个名为 build-css 的脚本,但是 运行 它,npm 运行 build-css 它给了我以下错误: 'tailwindcss' 未被识别为内部或外部命令

package.json 文件

{
  "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错误

如果您使用的是 Tailwind 2.x,则必须使用 Craco 对其进行正确配置。请遵循 Tailwind 文档中的 this guideline