无法在Angular 6中添加Bootstrap 4 [英] Can´t add Bootstrap 4 in Angular 6
本文介绍了无法在Angular 6中添加Bootstrap 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试使用
npm install bootstrap
在那之后,当我尝试运行它时收到一条错误消息.
After that, I got an error message when I tried to run it.
ng serve --open
我在angular.json中添加了Bootstrap
I Add Bootstrap in angular.json
像这样
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
错误消息是
ERROR in multi ../node_modules/bootstrap/dist/css/bootstrap.min.css ./src/styles.css
Module not found: Error: Can't resolve '...\node_modules\bootstrap\dist\css\bootstrap.min.css' in '...'
为什么收到错误消息?
推荐答案
在Angular.json中删除"../node_modules/bootstrap/dist/css/bootstrap.min.css",
.
Delete "../node_modules/bootstrap/dist/css/bootstrap.min.css",
in the Angular.json.
尝试将此@import "~bootstrap/dist/css/bootstrap.css";
添加到您的style.css文件中.
Try add this @import "~bootstrap/dist/css/bootstrap.css";
to your style.css file.
参考:对Angular CLI v6应用程序进行样式设置使用Bootstrap
这篇关于无法在Angular 6中添加Bootstrap 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文