angular2-cli给出@multi样式错误 [英] angular2-cli gives @multi styles error

查看:161
本文介绍了angular2-cli给出@multi样式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用angular2-cli,并创建了一个新项目.我想在项目中使用bootstrap,因此我安装了bootstrap,然后想导入bootstrap css文件,如此处angular2-cli指南中所示. https://github.com/angular/angular-cli#global-library-installation 运行ng serve后,出现以下错误.

I started using angular2-cli recently and created a new project. I wanted to use bootstrap in my project hence I installed bootstrap and then wanted to import the bootstrap css file like it is shown in the the angular2-cli guide here. https://github.com/angular/angular-cli#global-library-installation After running ng serve I get the following error.

多种样式中的错误找不到模块:错误:无法解决 '/home/krishna/angular2_migrate/webui/node_modules/bootstrap/dist/css/bootstrap.min.css' 在 '/home/krishna/angular2_migrate/webui/node_modules/angular-cli/models' @多种样式

ERROR in multi styles Module not found: Error: Can't resolve '/home/krishna/angular2_migrate/webui/node_modules/bootstrap/dist/css/bootstrap.min.css' in '/home/krishna/angular2_migrate/webui/node_modules/angular-cli/models' @ multi styles

我在做什么错了?

有关angular2-cli版本的信息

Information about angular2-cli version

krishna@Krishna:~/angular2_migrate/webui$ ng version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.17
node: 4.4.3
os: linux x64

推荐答案

在路径前添加../.

在angular-cli.json中,

In angular-cli.json,

"styles": [
  "../node_modules/bootstrap/dist/css/bootstrap.min.css",
  "styles.scss"
]

更新

angular7中有angular.json文件,您无需在路径前添加../

In angular7, there is angular.json file and you do not need to add ../ before path

这篇关于angular2-cli给出@multi样式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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