如何在npm中包含bootstrap-vue



我正在使用vue.js,webpack,npm和jquery。现在,我想在我的项目中包括框架bootstrap-vue。我遵循https://bootstrap-vue.js.org/docs的指南,并随附了Bootstrap-vue。在启动NPM的构建过程时,我会因:

而遇到过多的错误。
ERROR in ./node_modules/bootstrap-vue/es/utils/popover.class.js
Module not found: Error: Can't resolve '@babel/runtime/helpers/typeof' in 
'C:UsersabdulWebstormProjectseditornode_modules
bootstrap-vueesutils'
@ ./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 }
})

我对其他JavaScript文件有类似的错误。popover.class.js是其中之一。

i除了通过bootstrap-vue成功构建。可选:我可以在其他方式上包括Bootstrap-vue。

安装vue-cli 3并添加bootstrap-vue作为插件

运行以下命令:

npm install -g @vue/cli
vue create project-name
cd project-name
vue add bootstrap-vue

将自动添加和配置插件。

创建项目,然后运行此命令:

npm i bootstrap-vue

最新更新