5

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
1
  • 2
    Adds this line import Vue from 'vue' at the beginning of main.js. And add console.log(createApp) at the following line of import {createApp}, I think createApp is undefined. Commented Aug 20, 2020 at 0:56

1 Answer 1

4

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')
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.