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

新版本ESLint报错

TypeError: this.cliEngine is not a constructor

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

TypeError: this.cliEngine is not a constructor

TypeError: this.cliEngine is not a constructor
    at ESLintPlugin.invokeESLint (D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.1\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:78:25)
    at ESLintPlugin.getErrors (D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.1\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:67:21)
    at ESLintPlugin.onMessage (D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.1\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:35:29)
    at Interface. (D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\js-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

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

plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js

找到大概25行

把原来的

this.cliEngine = require(this.basicPath + "lib/cli-engine");

替换为

this.cliEngine = require(this.basicPath + "lib/cli-engine").CLIEngine;

重启IDEA即可

你可能感兴趣的:(工具的使用)