簡體   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