无法在 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 '...'
为什么我会收到错误消息?
Why did I get the error message?
推荐答案
删除 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 应用程序使用引导程序
这篇关于无法在 Angular 6 中添加 Bootstrap 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文