在向Vue3项目中装bootstrap时,总是遇到如下报错:
[ERROR] No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node_modules/bootstrap-vue/esm/vue.js:13:7:
import Vue from 'vue';
[ERROR]Nomatching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node modules/bootstrap-vue/esm/vue.js:13:7:
13 | import Vue from 'vue';
[ERROR] No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node_modules/bootstrap-vue/esm/vue.js:13:7:
13 | import Vue from'vue';
[ERROR] No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node modules/bootstrap-vue/esm/vue.js:13:7:
13 | import Vue from 'vue';
[ERROR] No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node_modules/bootstrap-vue/node_modules/portal-vue/dist/portal-vue.esm.js:13:7:
13 | import Vue from 'vue';
18:00:00 [vite] error while updating dependencies:
Error: Build failed with 7 errors:
node modules/bootstrap-vue/esm/vue.js:13:7: ERROR: No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node modules/bootstrap-vue/esm/vue.js:13:7: ERROR: No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node modules/bootstrap-vue/esm/vue.js:13:7: ERROR: No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
node_modules/bootstrap-vue/esm/vue.js:13:7: ERROR: No matching export in "node modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
在找了很多篇关于安装bootstrap的博客之后,终于找到原因了(泪)
是因为缺少popper.js包,bootstrap依赖于popperjs。
所以这时候我们只需要
npm install bootstrap @popperjs/core --save
就可以解决报错的问题了。