引导程序不连接到角6? [英] bootstrap not connect to the angular 6?

查看:49
本文介绍了引导程序不连接到角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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆