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

查看:17
本文介绍了引导程序未连接到 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';

此后我收到此错误:

多个 ./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

这篇关于引导程序未连接到 angular 6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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