TypeError: this.CliEngine is not a constructor

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

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


  function ESLintPlugin(state) {
        this.filterSource = state.filterSource;
        this.additionalRulesDirectory = state.additionalRootDirectory;
        this.calcBasicPath(state.eslintPackagePath);
        this.version = this.readVersion();
        if (this.initError == null) {
            this.linter = require(this.basicPath + "lib/cli.js");
            this.options = require(this.basicPath + "lib/options");
            this.CliEngine = require(this.basicPath + "lib/cli-engine");
        }
    }
    

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

然后重启webstorm

发布了110 篇原创文章 · 获赞 19 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_34817440/article/details/104278778