TypeError: this.CliEngine is not a constructor

比眉伴天荒 2023-07-04 15:41 125阅读 0赞

vue cli3 项目老是提示TypeError: this.CliEngine is not a constructor这个,看着特别扭

解决方法也不难,直接点击Details
在这里插入图片描述
然后再点击,如下第一个文件链接
在这里插入图片描述
找到如下方法

  1. function ESLintPlugin(state) {
  2. this.filterSource = state.filterSource;
  3. this.additionalRulesDirectory = state.additionalRootDirectory;
  4. this.calcBasicPath(state.eslintPackagePath);
  5. this.version = this.readVersion();
  6. if (this.initError == null) {
  7. this.linter = require(this.basicPath + "lib/cli.js");
  8. this.options = require(this.basicPath + "lib/options");
  9. this.CliEngine = require(this.basicPath + "lib/cli-engine");
  10. }
  11. }

this.CliEngine = require(this.basicPath + "lib/cli-engine"); 更改为 this.CliEngine = require(this.basicPath + "lib/cli-engine").CLIEngine;

然后重启webstorm

发表评论

表情:
评论列表 (有 0 条评论,125人围观)

还没有评论,来说两句吧...

相关阅读