Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to resolve ''vue' should be listed in the project's dependencies' in Nuxt.js

I am getting this error 'vue' should be listed in the project's dependencies. Run 'npm i -S vue' to add it...

The Happens when I import Vue in my plugin:

import Vue from 'vue';
Vue.prototype.$bannerHeight = 200

For now I can fix the error by mentioning /* eslint-disable import/no-extraneous-dependencies */ on top of the file but doing the same for all plugins that's kinda sucks.

Also, in my .eslintrc.js I tried add it in rules, for some reason it doesn't work (tried switching to true/false) and more over it's not good to turn the error OFF:

...
extends: [
  'plugin:vue/recommended',
  'airbnb-base',
],
plugins: ['vue'],
rules: {
  'import/no-extraneous-dependencies': ["error", {"devDependencies": true}],
  ...
},
...

Of course the error stated appearing when I started using airbnb-base. And, In nuxt.js project you don't have to define dependency of vue in package.json, nuxt will take care of it.

Please help, thanks.

Comments