Error: .eslintrc.js » eslint-config-standard: Environment key “es2021“ is unknown 版本兼容问题
Error: .eslintrc.js » eslint-config-standard: Environment key "es2021" is unknown
- 原因分析
- 解决方案
原因分析
在 Gulp 中集成 ESLint,安装 gulp-eslint 插件、eslint 模块,并且在 gulpfile.js 中使用gulp-eslint 插件,在运行 gulp 中的注册任务时,报出如下错误:
C:\Exercises\eslint-gulp>yarn gulp script
yarn run v1.22.10
$ C:\Exercises\eslint-gulp\node_modules\.bin\gulp script
[09:27:10] Using gulpfile ~\eslint-gulp\gulpfile.js
[09:27:10] Starting 'script'...
[09:27:10] 'script' errored after 867 ms
[09:27:10] Error: .eslintrc.js » eslint-config-standard:Environment key "es2021" is unknownat C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\shared\config-validator.js:169:19at Array.forEach (<anonymous>)at validateEnvironment (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\shared\config-validator.js:163:30)at validateConfigArray (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\shared\config-validator.js:334:9)at CascadingConfigArrayFactory._finalizeConfigArray (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js:417:13)at CascadingConfigArrayFactory.getConfigArrayForFile (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js:271:21)at CLIEngine.isPathIgnored (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\node_modules\eslint\lib\cli-engine\cli-engine.js:951:18)at Transform._transform (C:\Exercises\eslint-gulp\node_modules\gulp-eslint\index.js:43:14)at Transform._read (_stream_transform.js:191:10)at Transform._write (_stream_transform.js:179:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
上面的错误,是由于,eslint-config-standard 中 不识别 es2021
的运行环境。也就是说,gulp-eslint 、eslint 和 eslint-config-standard 版本不兼容。
模块版本,如下所示:
"eslint": "^7.14.0","eslint-config-standard": "^16.0.2","gulp-eslint": "^6.0.0",
解决方案
下面,修改 eslint-config-standard
的版本。
$ yarn add eslint-config-standard@14.1.1 eslint-plugin-standard --dev
注意
eslint-plugin-standard@5.0.0: standard 16.0.0 and eslint-config-standard 16.0.0 no longer require the eslint-plugin-standard package.
即:standard 16.0.0 和 eslint-config-standard 16.0.0 不再要求安装 eslint-plugin-standard 依赖。
Error: .eslintrc.js » eslint-config-standard: Environment key “es2021“ is unknown 版本兼容问题相关推荐
- npm run lint:提示TypeError: Failed to load plugin ‘jest‘ declared in ‘.eslintrc.js » ./eslint/config.j
加了eslint的依赖控制eslint的版本, 一般这个时候的配置会说,此处已经引入eslint,不用再额外引入eslint,但是依赖之间的不兼容会导致报错.详情见下: 不加会提示: @typescr ...
- Error: Failed to load config “standard“ to extend from
配置新项目的eslint报错 Error: Failed to load config "standard" to extend from 安装以下依赖就能解决了 npm i -- ...
- Vue中ESlint配置文件eslintrc.js文件详解
最近在跟着视频敲项目时,代码提示出现很多奇奇怪怪的错误提示,百度了一下是eslintrc.js文件没有配置相关命令,ESlint的语法检测真的令人抓狂,现在总结一下这些命令的解释,方便以后查阅. 默认 ...
- ESLint couldn‘t find the config “standard“ to extend from 解决办法
记一次给code-server配置eslint的经过 之前在code-server某个项目下配置eslint, 步骤如下: npm i eslint -g eslint --init # 走完配置流程 ...
- Eslint配置文件 `.eslintrc.js`
2019独角兽企业重金招聘Python工程师标准>>> module.exports = {// 如果有多个目录有.eslintrc.js配置文件,并且配置了此项,则不会再父级目录中 ...
- vue解决启动报错cjs loader.js Error: Cannot find module ‘../config‘问题
vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题 参考文章: (1)vue解决启动报错cjs loader.js Error ...
- 解决error ‘XXX‘ is not defined no-undef且项目没有eslintrc.js文件问题
问题描述 这是因为eslint的语法校验导致的问题,文件是通过public的index.html中<script src="xxxxxx.js"></script ...
- Vue中通过配置eslintrc.js文件来解决编译时出现的no-trailing-spaces、no-undef等错误
错误信息: D:\work\vue\workbench\src\views\login\index.vue12:10 warning 'Options' is defined but never us ...
- vscode配置setting和eslintrc.js
eslintrc.js module.exports = {root: true,// 此项指定环境的全局变量env: {browser: true,node: true,es6: true,},// ...
最新文章
- Linux supervisor守护进程的安装和使用
- 【Java学习笔记之二十五】初步认知Java内部类
- Cube 技术解读 | 详解「支付宝」全新的卡片技术栈
- Gradle常用配置-版本号自增
- 解决IE8下body{ overflow:hidden;}无效的解决办法
- Activiti 学习记录1 inclusiveGateway与 exclusiveGateway的区别
- 2017-10-08 前端日报
- html判断图片资源是否存在,javascript怎么判断图片是否存在?
- URLDecoder/URLEncoder使用场景
- java 缓存队列_双缓冲队列的java实现
- 深度学习中的深度是指什么_什么是深度学习
- 大星星学物联网概览篇-硬件
- 宠物店小程序开发线上预约
- 粉丝福利-2019云栖大会学习资料
- 八码数-IDA*算法
- 伺服电机选型常见的五大方面
- java source 1.5_解决:Java source1.5不支持diamond运算符,请使用source 7或更高版本以启用diamond运算符...
- #基于VR环境下的手指识别键盘输入# VR场景搭建和移动漫游(一)
- 微型机与应用与计算机,计算机期刊微型机与应用杂志
- 论文实验图片局部放大工具(可批量操作)