Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a declaration file for module 'vuetify/lib' in a fresh vue js project

I created a new vue project and after that i added vuetify,

$ vue create my-app
$ cd my-app
$ vue add vuetify
$ npm run serve

then i got this error

ERROR in /home/ruhith/Documents/vue/file upload/fileupload/src/plugins/vuetify.ts(2,21):
2:21 Could not find a declaration file for module 'vuetify/lib'. '/home/ruhith/Documents/vue/file upload/fileupload/node_modules/vuetify/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/vuetify` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuetify/lib';`
    1 | import Vue from 'vue';
  > 2 | import Vuetify from 'vuetify/lib';
      |                     ^
    3 | 
    4 | Vue.use(Vuetify);
    5 | 
Version: typescript 3.8.3
Time: 2774ms

what did i missed here?is this a bug in vuetufy?

like image 242
Ruhith Udakara Avatar asked Apr 05 '20 16:04

Ruhith Udakara


1 Answers

You need to add vuetify's types to tsconfig.json, like this:

// tsconfig.json
{
  "compilerOptions": {
    "types": ["vuetify"]
  }
}

Taken from FAQ here: https://vuetifyjs.com/en/getting-started/frequently-asked-questions/#questions

like image 171
Kirill Groshkov Avatar answered Sep 21 '22 08:09

Kirill Groshkov