首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用npm在vue.js中包含bootstrap-vue?

如何使用npm在vue.js中包含bootstrap-vue?
EN

Stack Overflow用户
提问于 2019-02-18 00:11:36
回答 2查看 13.9K关注 0票数 3

我用的是vue.js、webpack、npm和jQuery。现在我想在我的项目中包含框架bootstrap-vue。我通过npm遵循了https://bootstrap-vue.js.org/docs的指南,并包含了bootstrap-vue。在启动npm的构建过程时,我收到了太多使用babel运行时的错误,比如:

代码语言:javascript
复制
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:

代码语言:javascript
复制
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就是其中之一。

我希望使用bootstrap-vue成功运行构建。可选:我可以通过其他方式包含bootstrap-vue。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-02-18 13:10:45

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

运行以下命令:

代码语言:javascript
复制
npm install -g @vue/cli

vue create project-name

cd project-name

vue add bootstrap-vue

插件将自动添加和配置。

票数 7
EN

Stack Overflow用户

发布于 2019-10-15 04:01:55

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

代码语言:javascript
复制
npm i bootstrap-vue
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54735072

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档