Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include bootstrap-vue in vue.js with npm?

I am using vue.js, webpack, npm and jQuery. Now I want to include the framework bootstrap-vue in my project. I followed the guide of https://bootstrap-vue.js.org/docs via npm and included bootstrap-vue. While starting the build-process of npm, I am getting too many errors with babel-runtime like:

ERROR in ./node_modules/bootstrap-vue/es/utils/popover.class.js
Module not found: Error: Can't resolve '@babel/runtime/helpers/typeof' in 
'C:\Users\abdul\WebstormProjects\editor\node_modules\
bootstrap-vue\es\utils'
@ ./node_modules/bootstrap-vue/es/utils/popover.class.js 10:38-78
@ ./node_modules/bootstrap-vue/es/directives/popover/popover.js
@ ./node_modules/bootstrap-vue/es/directives/popover/index.js
@ ./node_modules/bootstrap-vue/es/directives/index.js
@ ./node_modules/bootstrap-vue/es/index.js
@ ./src/main.js

main.js:

import Vue from 'vue'
import App from './App'
import router from './router'
import 'jquery'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.use(BootstrapVue)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})

I have similar errors like this for other javascript files. Popover.class.js is one of them.

I except a successful run build with bootstrap-vue. Optional: I could include bootstrap-vue on other ways.

like image 597
Abdulkadir Uyanik Avatar asked Dec 18 '22 18:12

Abdulkadir Uyanik


1 Answers

Install vue-cli 3 and add bootstrap-vue as a plugin

Run these commands:

npm install -g @vue/cli

vue create project-name

cd project-name

vue add bootstrap-vue

The plugin will be automatically added and configured.

like image 165
gian29 Avatar answered Jan 02 '23 15:01

gian29