Solvedangular cli Error in multi styles

OS?

Windows 7 x64

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0.-beta.15
node: 4.4.7

Repro steps.

The app was created with angular-cli: ng new
I added semantic.min.css under src/assets folder

in angular-cli.json,
"apps" : [
{
"styles": [
"../src/assets/sematic.min.css",
"styles.css"
],
}
]

The log given by the failure.

run: ng serve

ERROR in multi styles
Module not found: Error: Can't resolve 'c:\working\ng2\reddit\src\assets\sematic.min.css' in 'c:\working\ng2\reddit\node_modules\angular-cli\models'
@ multi styles

Mention any other details that might be useful.


34 Answers

✔️Accepted Answer

Paths in angular-cli.json are relative to the project root (src/ normally). For instance, you have the src/styles.css file, but in angular-cli.json it's listed only as styles.css.

Other Answers:

I solved in the following way.
I am using Angular 7. During ng new my-app when prompted i took the sass option, as a result the style file was created with the name - styles.scss but what is referred in angular.json is styles.sass, I changed the extension to .scss in angular.json and boom, it's working now.

Hope it helps.

Another problem could be the missing of one of the styles. For example, if you have:

../node_modules/bootstrap/dist/css/bootstrap.min.css, ../node_modules/xxx/xxx/xxx.css, ../node_modules/yyy/yyy/yyy.css

And the xxx.css is missing - Error thrown will be Error in multi styles. Check the path for every module or asset.

I had the same issue. But I have solved it.
Main error is in the scripts and css which are coming from the 'node_modules' folder.
Go to '.angular-cli.json' file and delete all 'node_modules' files and manually type the path of your all SCRIPTS and CSS ..

Thanks

@filipesilva :thanks...it works. So the path in angular-cli.json references to src/. So if your path is some directory on same level as src say node_modules then in angular-cli.json reference the file as ../node_modules/

More Issues: