DornescuM
DornescuM

Reputation: 53

Vue is not defined Bootstrap-vue

I've installed in vue js bootstrap vue, with the following command yarn add bootstrap-vue bootstrap axios

Code: Image 1

enter image description here

    ERROR  Failed to compile with 1 errors                                                                                             2:56:01 AM
    
     error  in ./src/main.js

Module Error (from ./node_modules/eslint-loader/index.js):

/home/ronin/Documents/V2/test/src/main.js
  7:1  error  'Vue' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)


 @ multi (webpack)-dev-server/client?http://192.168.0.161:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

Upvotes: 5

Views: 5514

Answers (1)

Yondonjamts Ganzorig
Yondonjamts Ganzorig

Reputation: 323

If you wanted to use Vue.use() you needed to import Vue from 'vue'

Or import { createApp, use } from 'vue' and use use() function instead of Vue.use()

And you might needed to reconsider on import orders.

Eg:

import { createApp, use } from 'vue'

import App from './App.vue'
import router from './router'
import BootstrapVue from 'bootstrap-vue'

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

use(BootstrapVue)
createApp(App).use(router).mount('#app')

Or you could import whole vue shown below

import Vue from 'vue'
import App from './App.vue'
import router from './router'

import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.use(BootstrapVue)
Vue.createApp(App).use(router).mount('#app')

Upvotes: 4

Related Questions