繁体   English   中英

插件“react”在“package.json » eslint-config-react-app 之间发生冲突

[英]Plugin "react" was conflicted between "package.json » eslint-config-react-app

安装反应后出现此问题

在此处输入图像描述

我遇到了同样的错误。

您创建此应用的路径位于:

\Users\TONMOY\Onedrive\feedback-ui\

路径名区分大小写。 您创建的应用程序区分大小写,因此您在文件夹...\Onedrive\.....中创建了应用程序,而设备中的正确路径是...\OneDrive\....

这可能是 VS Code 的问题。

我发现的解决方法是,在 Visual Studio 终端中,我使用正确的情况导航到正确的文件夹路径,在你的情况下应该是

\Users\TONMOY\OneDrive\feedback-ui\

在此之后,从 VS Code 终端运行您的应用程序应该可以正常工作。 这在 Visual Studio Code 中对我有用。

更新:这只是一个临时修复。 在重新启动 VS Code 时,它会恢复到错误的情况。

相反,您可以加载 VS Code 并手动浏览您的系统目录和 select 您的项目文件夹一次。 这样做之后,即使重新启动,路径的情况也不会恢复。

我去了node_modules/react-scripts/config.Acutally它是另一个文件夹,没有你上面提到的那个文件。

再次安装节点模块 package。 npm i

这对我也有用,进入文件 webpack.config.js 位于:node_modules > react-scripts > config 我评论了位于文件末尾的所有摘录:评论所有这部分

  !disableESLintPlugin &&
        new ESLintPlugin({
          // Plugin options
          extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
          formatter: require.resolve('react-dev-utils/eslintFormatter'),
          eslintPath: require.resolve('eslint'),
          failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
          context: paths.appSrc,
          cache: true,
          cacheLocation: path.resolve(
            paths.appNodeModules,
            '.cache/.eslintcache'
          ),
          // ESLint class options
          cwd: paths.appPath,
          resolvePluginsRelativeTo: __dirname,
          baseConfig: {
            extends: [require.resolve('eslint-config-react-app/base')],
            rules: {
              ...(!hasJsxRuntime && {
                'react/react-in-jsx-scope': 'error',
              }),
            },
          },
        }),

感谢你

返回旧的 React 项目时出现此错误。 我不得不更新反应脚本 package。 可以在此处找到有关如何执行此操作的信息:

https://create-react-app.dev/docs/updating-to-new-releases/

好吧,我遇到了同样的问题,如果运行npm ls eslint-config-react-app来查看正在使用的配置和包。 或者运行npm update eslint然后最后重新运行npm start 这应该按预期工作。

我做了什么来解决这个问题,我进入了位于: node_modules > react-scripts > config的文件webpack.config.js并评论了位于文件末尾的所有摘录:

!disableESLintPlugin &&
    new ESLintPlugin({
      // Plugin options
      extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
      formatter: require.resolve('react-dev-utils/eslintFormatter'),
      eslintPath: require.resolve('eslint'),
      failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
      context: paths.appSrc,
      cache: true,
      cacheLocation: path.resolve(
        paths.appNodeModules,
        '.cache/.eslintcache'
      ),
      // ESLint class options
      cwd: paths.appPath,
      resolvePluginsRelativeTo: __dirname,
      baseConfig: {
        extends: [require.resolve('eslint-config-react-app/base')],
        rules: {
          ...(!hasJsxRuntime && {
            'react/react-in-jsx-scope': 'error',
          }),
        },
      },
    }),

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM