简体   繁体   English

无法加载在“package.json » eslint-config-react-app”中声明的插件“jsx-a11y”:意外的令牌 =

[英]Failed to load plugin 'jsx-a11y' declared in 'package.json » eslint-config-react-app': Unexpected token =

Just got this error from today, I have config in package.json file:今天刚收到这个错误,我在 package.json 文件中有配置:

"eslintConfig": {
  "extends": [
    "react-app",
    "react-app/jest"
  ]
},

I have not changed that file for ages, it was fine before today.我已经很久没有更改该文件了,今天之前还不错。 Anyone has idea?有人有想法吗? Thanks!谢谢!

Just try to compile frontend components css, js files etc. But failed to compile from today.刚刚尝试编译前端组件css,js文件等。但是从今天开始编译失败。

I think i finally realized what the issue is, i was running node 10.x version while the required node version was 14.x.我想我终于意识到问题所在,我运行的是节点 10.x 版本,而所需的节点版本是 14.x。 upgraded my node version and all resolved升级了我的节点版本并全部解决

In my case, we have a React app created with Create React App (CRA) back in 2019. CRA automatically gave us ESLint enabled by default, and lint was ran as part of 'react-scripts build'.就我而言,我们在 2019 年使用 Create React App (CRA) 创建了一个 React 应用程序。CRA 自动为我们默认启用了 ESLint,并且 lint 作为“react-scripts build”的一部分运行。 Our code for this app hasn't changed since early 2020.自 2020 年初以来,我们的此应用程序代码没有更改。

Now something has changed somewhere, and ESLint gave us this "unexpected token" regarding 'jsx-a11y'.现在某处发生了一些变化,ESLint 给了我们这个关于“jsx-a11y”的“意外标记”。 'React-scripts build' failed with our build server having Node 10.x version. “React-scripts build”因我们的构建服务器具有 Node 10.x 版本而失败。

Updating Node is one solution, as mentioned by previous answer.如前一个答案所述,更新节点是一种解决方案。 But in our case build server is using Node 10.6, managed by other team.但在我们的案例中,构建服务器使用的是 Node 10.6,由其他团队管理。 I cannot update Node there.我无法在那里更新节点。 I needed to get past this issue while still using Node 10.6.我需要在仍然使用 Node 10.6 的同时解决这个问题。

My quick solution was to disable the CRA-provided ESLint so it's not executed as part of build, and to add ESLint manually so I can run it on-demand within my dev environment.我的快速解决方案是禁用 CRA 提供的 ESLint,这样它就不会作为构建的一部分执行,并手动添加 ESLint,这样我就可以在我的开发环境中按需运行它。 (I also actually downgraded Node on my laptop to match Node version 10.6. used by build server, so I'll catch these more easily in the future.) (实际上,我还降级了我笔记本电脑上的 Node,以匹配构建服务器使用的 Node 10.6 版本,所以以后我会更容易地掌握这些内容。)

Few resources I found useful and combined from there: Disable ESLint that create-react-app provides , https://andrebnassis.medium.com/setting-eslint-on-a-react-typescript-project-2021-1190a43ffba我发现有用的资源很少,并从那里组合: 禁用 create-react-app 提供的 ESLint, https://andrebnassis.medium.com/setting-eslint-on-a-react-typescript-project-2021-1190a43ffba

Anyone knows the root cause of this error?有人知道这个错误的根本原因吗?

暂无
暂无

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

相关问题 无法加载在“package.json » eslint-config-react-app”中声明的插件“flowtype”:找不到模块“eslint/use-at-your-own-risk” - Failed to load plugin 'flowtype' declared in 'package.json » eslint-config-react-app': Cannot find module 'eslint/use-at-your-own-risk' 插件“react”在“package.json » eslint-config-react-app 之间发生冲突 - Plugin "react" was conflicted between "package.json » eslint-config-react-app 部署 React 应用程序时出错,它一直在说 &lt;&lt; Plugin "react" was conflicted between "package.json » eslint-config-react-app » &gt;&gt; - Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >> react/jsx-a11y eslint 为 control/label 抛出意外错误 - react/jsx-a11y eslint throws unexpected errors for control/label 无法加载在 'package.json » eslint-config-react-app#overrides[0]' 中声明的解析器 '@typescript-eslint/parser':找不到模块 'typescript' - Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript' 如何解决这个错误:package.json » eslint-config-react-app/jest#overrides[0]: Environment key "jest/globals" is unknown - How to solve this error: package.json » eslint-config-react-app/jest#overrides[0]: Environment key "jest/globals" is unknown ESlint jsx-a11y/anchor-is-valid 警告 - ESlint jsx-a11y/anchor-is-valid warning ReactJS:无法加载在“package.json”中声明的插件“testing-library”:找不到模块“./eslint-utils” - ReactJS : Failed to load plugin 'testing-library' declared in 'package.json : Cannot find module './eslint-utils' Atom &amp; eslint:找不到模块 'eslint-config-react-app' - Atom & eslint: Cannot find module 'eslint-config-react-app' 无法加载要扩展的配置“react-app”。 引用自:C:\\package.json - Failed to load config "react-app" to extend from. Referenced from: C:\\package.json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM