IDEA中新版本eslint报错 this.cliEngine is not a constructor

2020-05-09 14:58:39 浏览数 (2)

新版本ESLint报错

TypeError: this.cliEngine is not a constructor

点击details在控制台显示报错的位置

代码语言:javascript复制
TypeError: this.cliEngine is not a constructor

TypeError: this.cliEngine is not a constructor
    at ESLintPlugin.invokeESLint (D:Program FilesJetBrainsIntelliJ IDEA 2018.3.1pluginsJavaScriptLanguagelanguageServiceeslintbineslint-plugin.js:78:25)
    at ESLintPlugin.getErrors (D:Program FilesJetBrainsIntelliJ IDEA 2018.3.1pluginsJavaScriptLanguagelanguageServiceeslintbineslint-plugin.js:67:21)
    at ESLintPlugin.onMessage (D:Program FilesJetBrainsIntelliJ IDEA 2018.3.1pluginsJavaScriptLanguagelanguageServiceeslintbineslint-plugin.js:35:29)
    at Interface.<anonymous> (D:Program FilesJetBrainsIntelliJ IDEA 2018.3.1pluginsJavaScriptLanguagejsLanguageServicesImpljs-language-service.js:105:39)
    at Interface.emit (events.js:310:20)
    at Interface._onLine (readline.js:322:10)
    at Interface._normalWrite (readline.js:467:12)
    at Socket.ondata (readline.js:179:10)
    at Socket.emit (events.js:310:20)
    at addChunk (_stream_readable.js:286:12)
Process finished with exit code -1

找到自己错误提示中下述文件的路径 打开

代码语言:javascript复制
plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js

找到大概25行

把原来的

代码语言:javascript复制
this.cliEngine = require(this.basicPath   "lib/cli-engine");

替换为

代码语言:javascript复制
this.cliEngine = require(this.basicPath   "lib/cli-engine").CLIEngine;

重启IDEA即可

0 人点赞