Puja
Puja

Reputation: 101

Unable to install vuetify

While installing vuetify through vue add vuetify gives error .not sure what is this.Please find the error below : Error: Cannot find module '../presets/undefined'

Upvotes: 0

Views: 4041

Answers (1)

Bemn
Bemn

Reputation: 1391

I met the similar error when adding vuetify to my existing vue app. The webpack install guide works for me.

Note: I am new in Vue and Vuetify. Please let me know if I did something wrong in the following steps.

Here are some highlights:

  1. Add vuetify package:
$ npm install vuetify
  1. Create a Vuetify plugin js file e.g plugins/vuetify.js:
import Vue from 'vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'

Vue.use(Vuetify)

const opts = { /* your vuetify options*/ }

export default new Vuetify(opts)
  1. For webpack, you may also need to add some additional packages and add a extra config section in webpack.config.js (see the webpack install guide). If you are using parcel then you can skip this step.

  2. Use it in your entrypoint e.g. main.js

import Vue from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify' // path to vuetify export

new Vue({
  el: '#app',
  vuetify,
  render: h => h(App)
})

Set up your Vuetify <v-app> in App.vue:

<template>
  <v-app>
    <v-main>
      <v-container>
        <v-card :elevation="2" class="mx-auto pa-6">
          <h1>Hello Vuetify from <code>{{ name }}</code></h1>
        </v-card>
      </v-container>
    </v-main>
  </v-app>
</template>

<script>
const App = {
    data: function() {
        return {
            name: 'App'
        }
    }
}
export default App
</script>

Upvotes: 2

Related Questions