引导程序不连接到角6? [英] bootstrap not connect to the angular 6?
问题描述
npm install bootstrap
配置angular.json
:
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.scss"
]
直接在src/style.css
中导入:
@import '~bootstrap/dist/css/bootstrap.min.css';
在此之后我得到了这个错误:
after this i got this error:
多个./styles/bootstrap-4/css/bootstrap.min.css中的错误 ./src/styles.css找不到模块:错误:无法解析 '/Users/kobi.ktk/Documents/3yr/UI/a4app/styles/bootstrap-4/css/bootstrap.min.css' 在"/Users/kobi.ktk/Documents/3yr/UI/a4app"中
ERROR in multi ./styles/bootstrap-4/css/bootstrap.min.css ./src/styles.css Module not found: Error: Can't resolve '/Users/kobi.ktk/Documents/3yr/UI/a4app/styles/bootstrap-4/css/bootstrap.min.css' in '/Users/kobi.ktk/Documents/3yr/UI/a4app'
推荐答案
在angular 6中,您必须像下面这样:
In angular 6 you have to do it as bellow:
npm install --save bootstrap
然后仅在src/style.css
文件中添加:
@import 'bootstrap/dist/css/bootstrap.min.css';
在angular 6中,您不必将脚本添加到angular.json
文件
In angular 6 you don't have to add script to angular.json
file
这篇关于引导程序不连接到角6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!