javascript Create React App 提供的 react-scripts 包需要一个依赖:
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54000294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The react-scripts package provided by Create React App requires a dependency:
提问by
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.
项目依赖树可能有问题。这可能不是 Create React App 中的错误,而是您需要在本地修复的问题。
The react-scripts package provided by Create React App requires a dependency:
Create React App 提供的 react-scripts 包需要一个依赖:
"babel-eslint": "9.0.0"
"babel-eslint": "9.0.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:
不要尝试手动安装:您的包管理器会自动安装。但是,在树的更高位置检测到了不同版本的 babel-eslint:
回答by Hussam Kurd
create .envfile in your project file and add the following statement
.env在您的项目文件中创建文件并添加以下语句
SKIP_PREFLIGHT_CHECK=true
Save the file
保存文件
Remove node_modules, yarn.lock, package.lock
删除 node_modules、yarn.lock、package.lock
Then reinstall node_modules with
然后重新安装 node_modules
npm install
This should work
这应该工作
回答by Leonardo Bouchan
I had the same problem and do all the suggested steps but the problem still, so, my error is that i have a reactApp inside other Javascript App i had this structure.
我遇到了同样的问题,并执行了所有建议的步骤,但问题仍然存在,所以,我的错误是我在其他具有此结构的 Javascript 应用程序中有一个 reactApp。
--MyProjects
----NodeJsApp
----node_modules of NodeJsApp
----package.json of NodeJsApp
----ReactApp
------node_modules of ReactApp
------package.json of ReactApp
The problem solved to me deleting my ReactApp node_modules directory, then i do a reestructure of my directories because i have a disaster.
这个问题解决了我删除我的 ReactApp node_modules 目录,然后我重新构造了我的目录,因为我遇到了灾难。
--MyProjects
----NewDirectory (inside all about NodeJsApp)
------node_modules of NodeJsApp
------package.json of NodeJsApp
----ReactApp
------package.json of ReactApp
After that i do :
之后我做:
npm install
and then npm startand my problem has fixed, i think that the problem is that the parent directory cant have a javascript /nodeJs/ project or something that have node_modules .
然后npm start我的问题已经解决,我认为问题在于父目录不能有 javascript /nodeJs/ 项目或具有 node_modules 的东西。
回答by Marco Scabbiolo
Part of the output you provided says:
您提供的部分输出说:
Check if C:\Users\chawki\node_modules\babel-eslint is outside your project directory. For example, you might have accidentally installed something in your home folder.
检查 C:\Users\chawki\node_modules\babel-eslint 是否在您的项目目录之外。例如,您可能不小心在主文件夹中安装了某些东西。
Browse to C:\Users\chawki\node_modules\and delete the babel-eslintfolder, or simply delete C:\Users\chawki\node_modules.
浏览C:\Users\chawki\node_modules\并删除babel-eslint文件夹,或者直接删除C:\Users\chawki\node_modules.
回答by Marco Scabbiolo
Here What i did...
这里我做了什么...
C:\user\[yourUserName]\node_modules\babel-eslintand delete the fileC:\user\[yourUserName]\node_modules\eslintand delete the file
C:\user\[yourUserName]\node_modules\babel-eslint并删除文件C:\user\[yourUserName]\node_modules\eslint并删除文件
回答by Vishnu Verma
Delete your eslintand babel-eslintfile from your node modules on your computer e.g. -C:\Users\vishnu\node_modules-delete eslintand babel-eslintfile.
从计算机上的节点模块中删除您的eslint和babel-eslint文件,例如-C:\Users\vishnu\node_modules-delete eslint和babel-eslint文件。
In your project:
在您的项目中:
yarn remove eslint
yarn add --dev [email protected]
yarn remove babel-eslint
yarn add --dev [email protected]
回答by Yilmaz
in package.json
在 package.json 中
resolutions:{
"babel-eslint": "9.0.0"
}
if you reinstall your all dependencies, you will be forcing "babel-eslint" to be version "9.0.0". if you start your app, you will have no issue.
如果您重新安装所有依赖项,您将强制“babel-eslint”版本为“9.0.0”。如果您启动您的应用程序,您将没有问题。
回答by obini
I just deleted the node_modulesfolder (for me it was C:\user\[yourUserName]\node_modules\) and re-installed it.
我刚刚删除了该node_modules文件夹(对我来说是C:\user\[yourUserName]\node_modules\)并重新安装了它。

