[英]Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>
I have been having a little bit of issues when deploying my create react app, as it fails to compile and tells me Plugin "react" was conflicted between "package.json » eslint-config-react-app »我在部署我的 create react 应用程序时遇到了一些问题,因为它无法编译并告诉我插件“react”在“package.json » eslint-config-react-app » 之间发生冲突
I was wondering if somebody has encountered the same issue and knows how to solve it, thank you.请问有没有人遇到过同样的问题,知道怎么解决,谢谢。 I am still very new to all this.
我对这一切还是很陌生。
There is a conflict in the casing外壳有冲突
C:\Users\Ruben|desktop\reactapp\test.... whereas the nodemodules is looking for C:\Users\Ruben|Desktop\Reactapp\test.... C:\Users\Ruben|desktop\reactapp\test.... 而 nodemodules 正在寻找 C:\Users\Ruben|Desktop\Reactapp\test....
This is a windows specific problem, and previously react would have run the app regardless of this difference.这是一个 windows 特定问题,无论这种差异如何,之前的 react 都会运行应用程序。 Not anymore it seems.
现在好像没有了。
The solution I used was to locate the folder and open with code;我使用的解决方案是找到文件夹并使用代码打开; that ensures that the path matches directly with what is stored in node modules
确保路径与节点模块中存储的内容直接匹配
Faced with the same issue on Windows 10 & VS Code & npm.在 Windows 10 & VS Code & npm 上面临同样的问题。 As a workaround, open the package.json file in VS Code and save it (ctrl+s), then it works.
作为一种解决方法,在 VS Code 中打开 package.json 文件并保存(ctrl+s),然后它就可以工作了。 You may need to repeat this step each time, a bit annoying.
您可能需要每次都重复此步骤,有点烦人。
The error occurred from the terminal, i had similar issues for a long time trying series of things from trying to update my dependencies using "npm install" to saving the package.json file, but all this approach will only fix the issue temporarily.错误发生在终端,很长一段时间以来我都遇到了类似的问题,尝试使用“npm install”更新我的依赖项到保存 package.json 文件,但所有这些方法只能暂时解决问题。 The best and permanent solution is for you to cd into the project correctly from your terminal, the latest react is sensitive to the casing.
最好和永久的解决方案是让您从终端正确地进入项目,最新的反应对外壳敏感。 eg you cd into C:\Users\Desktop\reacttutorials\antd-demo while the correct path is C:\Users\Desktop\ReactTutorials\antd-demo
例如,您 cd 进入 C:\Users\Desktop\reacttutorials\antd-demo 而正确的路径是 C:\Users\Desktop\ReactTutorials\antd-demo
Note the change in the casing.注意外壳的变化。
Just re-save package.json, that worked for me.只需重新保存 package.json,这对我有用。
I also ran into this problem on a Mac.我也在 Mac 上遇到了这个问题。 As a temporary workaround, I was able to fix this by downgrading to version 6, by running
作为临时解决方法,我可以通过运行降级到版本 6 来解决此问题
yarn remove eslint-config-react-app
followed by其次是
yarn add eslint-config-react-app@6
I ran this twice.我跑了两次。 Always failed with version 7 (eslint-config-react-app without the "@6"), and always succeeded with version 6. YMMV, especially if you really need version 7.
版本 7 总是失败(eslint-config-react-app 没有“@6”),版本 6 总是成功。YMMV,特别是如果你真的需要版本 7。
I got this error when installing React with Visual Studio 2022 Standalone React project.使用 Visual Studio 2022 Standalone React 项目安装 React 时出现此错误。 The problem was Visual Studio showed my project name in Capitalized (as I typed), however, the folder name was in small-caps.
问题是 Visual Studio 以大写字母显示我的项目名称(当我键入时),但是,文件夹名称是小型大写字母。
The fix was to manually rename the folder name to match the project name as shown in Visual Studio.修复方法是手动重命名文件夹名称以匹配项目名称,如 Visual Studio 中所示。
Windows 10 with VS Code user. Windows 10 与 VS 代码用户。 I re-installed es-lint-config-react-app with yarn, or npm if you use it.
我用 yarn 重新安装了 es-lint-config-react-app,或者 npm 如果你使用它。 and everything seems to be fixed so far.
到目前为止,一切似乎都已解决。
Solution worked for me.解决方案对我有用。
npm remove eslint-config-react-app
Tried reinstalling eslint but throwing the same error.尝试重新安装 eslint 但抛出相同的错误。 Just removing worked fine for me.
只是删除对我来说很好。
i have the same err but cant figure it out... i am saying it to the discord server but no response..and also this is not happening with that specific project but also giving this pop up err with every create-react-app project.我有同样的错误,但无法弄清楚......我对 discord 服务器说,但没有响应......而且该特定项目没有发生这种情况,但每个 create-react-app 都会出现此弹出错误项目。
I cleared my package-lock.json file and that fixed the issue for me我清除了我的 package-lock.json 文件,这为我解决了这个问题
I am facing the same problem.我面临同样的问题。 I didn't understand the solution explanation.
我不明白解决方案的解释。 How exactly did you fix that, please?
请问你具体是怎么解决的?
not sure if you were able to get this totally fixed.不确定你是否能够完全解决这个问题。 I ran into the same issue after updating react-scripts.
更新反应脚本后我遇到了同样的问题。 From what I could find this was a VS Code issue.
据我所知,这是一个 VS Code 问题。 By adding:
通过添加:
"eslint.options": {
"pattern": "./packages/*/"
},
to the settings json for vs code - this fixed it for me.到 vs 代码的设置 json - 这为我修复了它。 It stopped looking at the system or extension setting and instead uses the installed package version.
它停止查看系统或扩展设置,而是使用已安装的 package 版本。
Had the same problem with the name case.名称大小写也有同样的问题。 When creating the project, had named it "React2", but VS ignored my case and named the project's folder "react2" (lowercase) instead.
创建项目时,将其命名为“React2”,但 VS 忽略了我的情况,而是将项目的文件夹命名为“react2”(小写)。 The solution was to:
解决方案是:
mv react2 React2
to fix the name case.) mv react2 React2
来修复名称大小写。) I had the same issue as you, and i got tired doing Ctrl + S on package.json, which is a one of the solutions.我和你有同样的问题,我厌倦了在 package.json 上执行 Ctrl + S,这是解决方案之一。 Another way to solve that is your path you have Desktop (D uppercase) and the path that the error show to you have desktop (d lowercase) so you can rename that folder to desktop and it will solve the problem
解决该问题的另一种方法是您的路径具有桌面(D 大写)和错误显示给您的路径具有桌面(d 小写),因此您可以将该文件夹重命名为桌面,它将解决问题
I fixed this issue doing this in package.json file:我在 package.json 文件中解决了这个问题:
"eslintConfig": {
"extends": "react-app" //remove this line
},
I had this issue after updating mui.我在更新 mui 后遇到了这个问题。 None of the above solutions worked for me.
以上解决方案都不适合我。 Eventually, I ran npm dedupe a bunch of time and found all of the conflicted dependencies.
最终,我运行了 npm 重复数据删除了一段时间,发现了所有冲突的依赖项。 After making a bunch of edits to my package.json and npm installing, this error went away.
在对我的 package.json 和 npm 安装进行大量编辑后,此错误消失了。
I changed folder name, but I run the app from terminal in old folder name.我更改了文件夹名称,但我从终端以旧文件夹名称运行应用程序。
old Folder name: C:/.../ReactRepo/ReduxExample1 changed name: C:/.../ReactRepo/reduexample1旧文件夹名称:C:/.../ReactRepo/ReduxExample1 更改名称:C:/.../ReactRepo/reduexample1
How I solve from terminal:我如何从终端解决:
cd.. && cd reduexample1(paste here your new Folder Name) && npm start
cd.. && cd reduexample1(粘贴你的新文件夹名称) && npm start
This is an ongoing issue for me that appears when I edit and save any files and react tries to recompile.这对我来说是一个持续存在的问题,当我编辑和保存任何文件并尝试重新编译时会出现这种问题。 My temporary fix is whenever I save a file, I click on my package.json file, which I have constantly open on the side, and save.
我的临时修复是每当我保存文件时,我点击我的 package.json 文件,我一直在旁边打开并保存。 Then it compiles fine.
然后它编译得很好。
I solved this problem by deleting the eslint-config-react-app folder manually from node_modules and running yarn add eslint-config-react-app again.我通过从 node_modules 手动删除 eslint-config-react-app 文件夹并再次运行 yarn add eslint-config-react-app 解决了这个问题。
I have faced the same problem, what I've to do is open the project by right-clicking & opening with VS Code option.我遇到了同样的问题,我要做的是通过右键单击并使用 VS Code 选项打开项目。 Previously I was navigating to the project from the command prompt and opening this from the terminal itself, this was showing me the same error.
以前我从命令提示符导航到项目并从终端本身打开它,这向我显示了同样的错误。 I think this is a typical windows-related problem.
我认为这是一个典型的与 Windows 相关的问题。
A similar problem occurred to me as well.我也遇到了类似的问题。 Through
git cmd
with code.
通过
git cmd
带code.
command, I opened my project.命令,我打开了我的项目。 As a result, I got the same following error message.
结果,我收到了相同的以下错误消息。 I open my react project manually when I run
npm start
I have no problems with it当我运行
npm start
时,我手动打开我的反应项目我没有问题
I add the same problem, just open the Package.json file, save again and close it我添加了同样的问题,只要打开Package.json文件,再次保存并关闭它
Current react is case sensitive, Hence we have to specify the directory path with accurate casing.当前的反应是区分大小写的,因此我们必须用准确的大小写指定目录路径。
Eg:例如:
# This must be written with case sensitivity
C:\Users\Ruben|desktop\reactapp\test
C:\Users\Ruben|desktop\ReactApp\test
Soln.索恩。 Use cd and write accurate location
使用 cd 并写入准确的位置
I fixed this problem by updating the eslint
instead of saving package.json
every time.我通过更新
eslint
而不是每次都保存package.json
来解决这个问题。
npm update eslint
npm update eslint
This issue for me was caused by what I had typed into Powershell when cd'ing into the folder where I wanted the react app to live.对我来说,这个问题是由于我在进入我希望 React 应用程序所在的文件夹时在 Powershell 中输入的内容引起的。
I had typed the full path in lowercase, which didn't match the actual casing of the path.我输入了小写的完整路径,这与路径的实际大小写不匹配。
To resolve this, I performed the following:为了解决这个问题,我执行了以下操作:
npx create-react-app client-app
npx create-react-app client-app
npm start
npm start
And the app started without any issues.该应用程序启动时没有任何问题。
from package.json I removed:从 package.json 我删除了:
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
}
Then, I restarted the server with npm start
and my web app is working again.然后,我用
npm start
重新启动了服务器,我的网络应用程序再次运行。
Hope it can help希望能有所帮助
I, too, have faced the issue.我也遇到过这个问题。 The problem arises when you overlook the case of the folder that you're opening through the command prompt.
当您忽略通过命令提示符打开的文件夹的大小写时,就会出现问题。 eg your directory is something like E:\D\users* TODO *
例如,您的目录类似于 E:\D\users* TODO *
but in your terminal you typed cd todo-> this will give you the mentioned problem in the question asked.但是在你的终端中你输入了 cd todo-> 这会给你问题中提到的问题。 Just maintain the Case the way it's saved ie cd TODO
只需按照保存方式维护案例,即 cd TODO
Nothing Complicated Just Delete "package-lock.json" file没什么复杂的,只需删除“package-lock.json”文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.