Skip to content

Bug:TypeError: eslint.CLIEngine is not a constructor #6798

Open
@kaiyu-tech

Description

@kaiyu-tech

Version

4.5.15

Environment info

  System:
    OS: macOS 11.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 95.0.4638.54
    Edge: Not Found
    Firefox: Not Found
    Safari: 15.1
  npmGlobalPackages:
    @vue/cli: 4.5.15

Steps to reproduce

  1. run npm install -g @vue/cli to install the Vue CLI globally.
  2. Run vue create my-project to create the project.
  3. Run cd my-project and navigate to the directory where the project you created is located.
  4. Run npm audit fix --force because you will get a message that there is a vulnerability problem during installation.
  5. However, I get a message that the vulnerability issue cannot be resolved.
  6. Ignore the vulnerability issue for now and run npm run serve.
  7. TypeError: eslint.CLIEngine is not a constructor is raised.
$ npm install -g @vue/cli
$ vue create my-project
$ cd my-project
$ npm audit fix --force
$ npm run serve
$ npm run serve

> my-project@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...
98% after emitting CopyPlugin

 ERROR  Failed to compile with 1 errors                                                                         19:48:55

Module build failed (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):
TypeError: eslint.CLIEngine is not a constructor
    at Object.module.exports (~/work/oss-gate/my-project/node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js:223:27)

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

What is expected?

It seems that the problem has already been fixed in the dev branch (vuejs/vue-cli#6714), but I don't think the fix has been applied to the v4 branch.
Is is possible to backport that fix to v4 branch?

What is actually happening?

TypeError: eslint.CLIEngine is not a constructor is raised.


Supplementary information

If you ignore the vulnerability issue message and don't run npm audit fix --force, you won't get an error when you run npm run serve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions