Vue-cli: @vue/cli-plugin-eslint 4.0.0-rc.3 | TypeError: Cannot read property 'version' of undefined

Created on 12 Sep 2019  ·  10Comments  ·  Source: vuejs/vue-cli

Version

4.0.0-rc.3

Environment info

$ uname -a
Linux 6eecff0756dc 5.2.11-arch1-1-ARCH #1 SMP PREEMPT Thu Aug 29 08:09:36 UTC 2019 x86_64 Linux

$ node --version
v10.16.3

$ npm version
{ test: '0.1.0',
  npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  modules: '64',
  napi: '4',
  nghttp2: '1.39.2',
  node: '10.16.3',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.28.0',
  v8: '6.8.275.32-node.54',
  zlib: '1.2.11' }

package.json

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "lodash-es": "^4.17.15",
    "vue": "^2.6.10",
    "vue-router": "^3.1.2",
    "vuetify": "^1.5.5",
    "vuex": "^3.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@mdi/font": "^3.6.95",
    "@vue/cli": "4.0.0-rc.3",
    "@vue/cli-plugin-babel": "4.0.0-rc.3",
    "@vue/cli-plugin-eslint": "4.0.0-rc.3",
    "@vue/cli-plugin-unit-jest": "4.0.0-rc.3",
    "@vue/cli-service": "4.0.0-rc.3",
    "@vue/eslint-config-prettier": "^3.0.5",
    "@vue/test-utils": "^1.0.0-beta.29",
    "babel-jest": "^ 24.8.0",
    "html-webpack-harddisk-plugin": "^0.2.0",
    "normalize.css": "^8.0.1",
    "pug": "^2.0.4",
    "pug-plain-loader": "^1.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-template-compiler": "^2.6.10",
    "vuetify-loader": "^1.0.5",
    "webpack-manifest-plugin": "^2.0.4"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "optionalDependencies": {
    "@vue/cli-plugin-e2e-cypress": "4.0.0-rc.3"
  }
}

babel.config.js

module.exports = {
  presets: [
    "@vue/app",
  ],
};

Steps to reproduce

$ npm run serve


> [email protected] serve /test
> vue-cli-service serve

 ERROR  TypeError: Cannot read property 'version' of undefined
TypeError: Cannot read property 'version' of undefined
    at module.exports (/test/node_modules/@vue/cli-plugin-eslint/index.js:18:27)
    at plugins.forEach (/test/node_modules/@vue/cli-service/lib/Service.js:83:7)
    at Array.forEach (<anonymous>)
    at Service.init (/test/node_modules/@vue/cli-service/lib/Service.js:81:18)
    at Service.run (/test/node_modules/@vue/cli-service/lib/Service.js:220:10)
    at Object.<anonymous> (/test/node_modules/@vue/cli-service/bin/vue-cli-service.js:37:9)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-09-12T11_26_06_785Z-debug.log

What is expected?

successfully running webpack dev server.

What is actually happening?

TypeError: Cannot read property 'version' of undefined

is happed in

module.exports (/test/node_modules/@vue/cli-plugin-eslint/index.js:18:27)
needs reproduction

Most helpful comment

Did you just upgrade your dependencies directly from 3.0?
In v4 eslint is required as a dependency of the project itself.
So npm install --save-dev eslint@4 may fix the warning.

All 10 comments

Hi

Thanks for filing this issue! Could you please provide a small reproduction in a Github repository so we can debug this without trying to replicate this ourselves?

That would be very helpful, thanks!

@LinusBorg

Thank you for your quick response.
I created a repository to reproduce this issue's problem.

https://github.com/tomlla/vuejs-vue-cli-issues-4569

Did you just upgrade your dependencies directly from 3.0?
In v4 eslint is required as a dependency of the project itself.
So npm install --save-dev eslint@4 may fix the warning.

Note the eslint version should be 4 for the config you're currently using (@vue/eslint-config-prettier@3).
ESLint 5 & 6 are only supported if you update the config to the latest version, too.

@sodatea

Thank you for your suggestion.

Did you just upgrade your dependencies directly from 3.0?

Yes. I tried to upgrade my project that generated vue-cli v3.


Note the eslint version should be 4 for the config you're currently using (@vue/eslint-config-prettier@3).

Thankyou. I installed the eslint version 4 in add-eslint branch

I got another build error.

https://github.com/tomlla/vuejs-vue-cli-issues-4569/pull/2

Anyway, I'll try to fix my build error.

Is there information about how to upgrade the existing vue-cli v3 base probject to vue-cli v4?

How about trying it in a real-world app? There's neither .eslintrc.js file nor eslintConfig field of package.json in the reproduction repo. But in a real-world-app that can't happen.

As for the migration guide, it is still work-in-progress: https://github.com/vuejs/vue-cli/pull/4552/files

I'm trying to upgrade a real-world app.
But I can't publish all of the source code because my job contract.
I'll add more files if possible. let me know necessary files if you noticed.

now I added .eslintrc.js

https://github.com/tomlla/vuejs-vue-cli-issues-4569/pull/2/files

Hello!
This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues requiring feedback after 20 days of inactivity. It’s been at least 10 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. (A maintainer can also add the label not stale to keep this issue open.)

Thanks for being a part of the Vue community! 💪💚️

Hey again! 😸️

It’s been 20 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. 🤖 Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Vue community! 💚️

Was this page helpful?
0 / 5 - 0 ratings