[英]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.