2016-10-13 5 views
2

最近angular2-cliを使い始め、新しいプロジェクトを作成しました。私は私のプロジェクトでブートストラップを使いたかったので、ブートストラップをインストールして、ここのangular2-cliガイドに示されているようにブートストラップCSSファイルをインポートしたかったのです。 https://github.com/angular/angular-cli#global-library-installation サービスを実行した後、次のエラーが発生します。angular2-cliは@multi stylesエラーを返します

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のバージョン

[email protected]:~/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 

答えて

4

について

情報パスの前に../ます。アンギュラcli.jsonで

は、

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

は、私の場合はエラーが私は私の.angular-cli.jsonに

"styles":[ 
     "styles.css" 
    ] 

を有していただったので、私はそれを解決しました手動で私のすべてのスクリプトとCSSのパスを入力することによって、例えば

angular-cli.jsonのパスはプロジェクトルート(src /通常)からの相対パスです。たとえば、src/styles.cssファイルがありますが、angular-cli.jsonではstyles.cssとしてのみリストされています。

0

ここに私の修正があります。 であなたあなたは隠しファイルは「style.sass」を「style.cssにそれを開いて、変更 .angular-cli.jsonと呼ばれている、現在のディレクトリ:。 実行ngのビルドを、あなたが行われ

前: enter image description here アフター: enter image description here

関連する問題