Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 显示以下错误的react npm start命令_Reactjs - Fatal编程技术网

Reactjs 显示以下错误的react npm start命令

Reactjs 显示以下错误的react npm start命令,reactjs,Reactjs,我使用命令创建reactprojectcreate react app api教程,安装项目后,我使用命令npm start。它显示以下错误 There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provid

我使用命令创建
react
project
create react app api教程
,安装项目后,我使用命令
npm start
。它显示以下错误

    There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "babel-eslint": "10.1.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:

  D:\react_projects\node_modules\babel-eslint (version: 9.0.0)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if D:\react_projects\node_modules\babel-eslint is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-eslint in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-api-tutorial@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-api-tutorial@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\My Dell\AppData\Roaming\npm-cache\_logs\2020-05-23T17_04_50_525Z-debug.log
我已经删除了
包.lock.json
并重新安装了
节点单元模块
,在我的系统中更新的
react脚本
不起作用,因此每次创建
react
项目时,我都会使用
npm install react>命令降级
react脚本
的版本-scripts@2.1.8
当时它他工作得很好。现在它抛出上述错误

我如何解决这个问题

  • 删除package-lock.json或warn-lock.json和node_模块。 2.从package.json中删除babel eslint
  • 运行“npm安装”或纱线安装
  • 删除package-lock.json或warn-lock.json和node_模块。 2.从package.json中删除babel eslint
  • 运行“npm安装”或纱线安装

  • 你有一个.env文件吗?如果是,添加此
    SKIP\u PREFLIGHT\u CHECK=true
    您的应用程序中是否安装了
    babel eslint
    ?你需要它吗?尝试
    npm卸载babel eslint
    然后执行其他步骤。您有.env文件吗?如果是,添加此
    SKIP\u PREFLIGHT\u CHECK=true
    您的应用程序中是否安装了
    babel eslint
    ?你需要它吗?尝试
    npm卸载babel eslint
    然后执行其他步骤。