简体   繁体   English

yarn start 没有在 chrome 上打开 react 应用程序,但没有抛出错误?

[英]yarn start doesn't open react app on chrome but no errors are thrown?

I have a simple react app that I started recently just to study a few things and suddenly, when I try to run it with:我有一个简单的反应应用程序,我最近开始只是为了研究一些东西,突然,当我尝试运行它时:

yarn start

it does not throws any error, just stays like this:它不会抛出任何错误,只是保持这样:

yarn run v1.22.19
warning ..\package.json: No license field
$ react-scripts start

and nothing happens, what should i do?什么也没发生,我该怎么办?

PS: my complete package.json: PS:我完整的package.json:

    {
  "name": "prototype",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "framer-motion": "^7.1.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.1",
    "start": "^5.1.0",
    "styled-components": "^5.3.5",
    "web-vitals": "^2.1.0"
  },
  "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"
    ]
  },
  "devDependencies": {
    "eslint": "^8.21.0"
  }
}

As you can see in the error message the path of the package.json file is in the warning:正如您在错误消息中看到的 package.json 文件的路径在警告中:

yarn run v1.22.19
warning ..\package.json: No license field
$ react-scripts start

That double dots ..\ saying that the package.json file is one folder up from where you are running the yarn start command.那个双点..\表示 package.json 文件是您运行yarn start命令的一个文件夹。 It could be OUTSIDE the project folder you're working on.它可能在您正在处理的项目文件夹之外。

So if you go one directory up you will find another package.json file.因此,如果您将 go 向上一个目录,您会发现另一个 package.json 文件。 Either add "license" field into that package.json file or simply delete the file if you do not need it."license"字段添加到该 package.json 文件中,或者如果不需要该文件,只需删除它。

This should solve your problem.这应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我运行“npm start”来运行 React 应用程序时,它不会给出任何错误,而是永远挂起 - When I run "npm start" to run a React app , it doesn't give any errors but hangs forever instead heroku上的react app无法启动 - react app on heroku doesn't start 尝试创建React应用时出现纱线错误 - Yarn errors when trying to create a React app yarn start 无法运行新的 React 应用程序 - yarn start is not working to run the new react app 纱线创建带有打字稿抛出错误的反应应用程序 - yarn create react-app with typescript throwing errors 在 docker-compose 中没有启动带有 craco 的 React App - React App with craco doesn't start in docker-compose 使用 yarn dlx create-react-app 创建 React 应用程序后,第一次按 yarn start 启动它时,出现错误 - After creating a React app with yarn dlx create-react-app, the first time I press yarn start to start it, I get an error Dockerized Create React App 不会打开新选项卡 - Dockerized Create React App doesn't open a new tab 在React-Redux应用程序中模态框未打开 - Modal box doesn't open in react-redux app 反应:什么会阻止 'npm start' 工作。 localhost:3000 打不开 - REACT: what would stop 'npm start' from working. localhost:3000 doesn't open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM