找不到任务:"react-scripts:start"

Task not found: "react-scripts:start"

我已经为我的 React 项目配置 tailwind.css 并根据

编辑 React 脚本
"scripts": {
    "build:css": "postcss src/styles/index.css -o src/styles/tailwind.css",
    "watch:css": "postcss src/styles/index.css -o src/styles/tailwind.css --watch",
    "react-script:start": "timeout <5>  && react-scripts start",
    "start": "run-p watch:css react-scripts:start",
    "build": "run-s build:css react-scripts:build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

相应的软件包也已安装,没有任何错误。我要附上 package.json

{
  "name": "myblog",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-scripts": "^5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "build:css": "postcss src/styles/index.css -o src/styles/tailwind.css",
    "watch:css": "postcss src/styles/index.css -o src/styles/tailwind.css --watch",
    "react-script:start": "timeout <5>  && react-scripts start",
    "start": "run-p watch:css react-scripts:start",
    "build": "run-s build:css 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"
    ]
  },
  "devDependencies": {
    "autoprefixer": "^10.4.4",
    "npm-run-all": "^4.1.5",
    "postcss": "^8.4.12",
    "postcss-cli": "^9.1.0",
    "tailwindcss": "^3.0.23"
  }
}

然后我通过显示“找不到任务”不断得到错误

the error displayed in the terminal

到目前为止我尝试了什么

  1. 手动重新安装所有依赖项
  2. 更改 react 脚本命令后安装 npm
  3. 删除节点模块并重新安装
  4. 检查了所有的反应脚本并做了 npm-运行-all

您的 scripts 部分存在拼写错误:

"start": "run-p watch:css react-scripts:start" 正在寻找“react-scripts:”(复数,带有“s”),但您的脚本名称不包含该“s”(react-script: ").

  "scripts": {
    ...
    "react-script:start": "timeout <5>  && react-scripts start",
                 ^--- Does not contain the "s" - change this to: "react-scripts:start": "timeout <5>  && react-scripts start",

    "start": "run-p watch:css react-scripts:start",
    Looking for react-scripts with an s --^
  },