我最近开始使用angular2-cli,并创建了一个新项目。我想在我的项目中使用引导程序,所以我安装了引导程序,然后像这里的angular2-cli指南所示的那样导入引导css文件。运行ng https://github.com/angular/angular-cli#global-library-installation服务后,我得到以下错误。
找不到多样式模块中的错误:错误:无法解决'/home/krishna/angular2_migrate/webui/node_modules/bootstrap/dist/css/bootstrap.min.css‘中的'/home/krishna/angular2_migrate/webui/node_modules/angular-cli/models’@多样式
我做错什么了?
关于angular2-cli版本的信息
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发布于 2017-03-09 14:37:40
在路径前添加../。
在角-cli.json中,
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.scss"
]更新
在angular7中,有angular.json文件,您不需要添加../在路径之前
发布于 2019-02-01 02:51:16
在角7中,文件名为'angular.json‘。
确保为“样式”选项设置了正确的扩展集。在我的例子中,我安装了带有SCSS选项的角CLI,但是在默认情况下扩展被设置为SASS。
"styles": [
"src/styles.scss" // default was: src/styles.sass
],

发布于 2018-05-27 00:29:27
我使用的是角6,所以我的文件名是angular.json,但是我能够通过删除它所要求的"../“路径来解决类似的问题。下面是我添加引导和jquery到我的角度应用程序的设置。
"styles": [
"src/styles.css",
"node_modules/bootstrap/dist/css/bootstrap.css"
],
"scripts": ["../node_modules/jquery/dist/jquery.js",
"node_modules/bootstrap/dist/js/bootstrap.bundle.js"
]注释: jquery需要“./”,而不需要它。
根据我遇到的问题选择:
"styles": [
"src/styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.bundle.js"
]此外,本文还包含了设置它的多个备选选项。
https://stackoverflow.com/questions/40025762
复制相似问题