将 React 项目克隆到新 PC 上

Cloneing a React project onto a new PC

我有一个非常非常基本的反应应用程序,我在我的桌面上制作并推送到 git。我现在正在尝试克隆该存储库并将其构建在我的笔记本电脑上。当我克隆 repo 时,我 运行 npm install 成功时,我 运行 yarn start 只会受到这样的欢迎:

我真的不知道那条消息是什么意思。我将包括我的 package.json 以备不时之需。请询问您还需要什么。我该如何解决这个问题?

顺便说一句,这是我的文件结构:

Package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "bootstrap": "^4.6.0",
    "react": "^17.0.1",
    "react-bootstrap": "^1.5.0",
    "react-dom": "^17.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "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"
    ]
  }
}

如果您想自己尝试,这里是 repo:https://github.com/ZoeyOneOhOne/React-DOH-Template

删除node_modulespackage-lock.jsonyarn.lock然后输入npm cache clean --force,npm install

问题很可能会得到解决

终于解决了这个问题。 react-scripts 4.0.3 似乎有一些问题。我在 package.json 中更改了这一行:

"react-scripts": "4.0.3",

"react-scripts": "4.0.1",

现在一切正常。