angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Error in multi styles

Open hnguyenec opened this issue 10 years ago • 33 comments

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.


hnguyenec avatar Sep 28 '16 23:09 hnguyenec

Thanks @anmolsrepo .

BraianS avatar Feb 06 '19 15:02 BraianS

captura de tela 2019-02-11 as 22 31 55 Need fix it in angular-cli ? I face the same problem, works well when change the file in angular.json, but would be good If this file generated by angular-cli.

epontes avatar Feb 12 '19 00:02 epontes

Does anyone have the solution to this problem? Older version works fine but not this 7.3

dreadfear avatar Feb 22 '19 06:02 dreadfear

I had issue when I newly create project while serving it. Error was ERROR in multi ./styles.sass Just renamed all "styles": [ "src/styles.sass" ]to "styles": [ "src/styles.scss" ]in angular.json file because main css file was style.scss

mard0n avatar Feb 24 '19 08:02 mard0n

Also, verify that "styleext": "scss" in angular.json under the app's schematics section.
A friend of mine had it set to "sccs", and wasted an hour chasing down the solution.

dphochman avatar Mar 05 '19 14:03 dphochman

I try this and it works for me "styles": [ "./node_modules/bootstrap/dist/css/bootstrap.min.css", "./src/styles.scss" ],

AdelekeAmoo avatar Mar 19 '19 09:03 AdelekeAmoo

Can anybody help me with this? ERROR in multi ../node_modules/aos/dist/aos.css ./src/styles.css Module not found: Error: Can't resolve 'C:\node_modules\aos\dist\aos.css' in 'C:\Angular6Project'

I included aos for animation and sliding and it was working fine. But on the very next day this issue appeared.....

Mudassir-Idealake avatar Apr 18 '19 03:04 Mudassir-Idealake

Here is what I did to make it work!

  1. find "styles": [] in angular.json file.
  2. delete "../node_modules/bootstrap/dist/css/bootstrap.min.css",
  3. change "/src/styles.css" to "src/styles.scss",
  4. change file "styles.css" to "styles.scss"

duoduoren avatar May 16 '19 01:05 duoduoren

Here is what I did to make it work!

  1. find "styles": [] in angular.json file.
  2. delete "../node_modules/bootstrap/dist/css/bootstrap.min.css",
  3. change "/src/styles.css" to "src/styles.scss",
  4. change file "styles.css" to "styles.scss"

Thank you so much

Mudassir-Idealake avatar May 16 '19 03:05 Mudassir-Idealake

I think it is because of the problem with bootstrap, try this: Step 1. Inside .angular-cli.json file

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

Remove "../node_modules/bootstrap/dist/css/bootstrap.min.css"

Step 2. Go to styles.css

Import bootstrap by adding this line @import "~bootstrap/dist/css/bootstrap.css";

These steps solved the errors I got during the building process.

It worked. Thank you

hembk44 avatar Aug 30 '19 08:08 hembk44

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.

Angular 7 needs style file’s relative path from main project folder, so in angular.json make sure all references to styles.scss include src/: "styles": [ "src/styles.scss" ],

Moreover, when you reference a npm package css/scss files in your styles.scss do it with ~ like so: @import '~font-awesome/scss/font-awesome';

This is a breaking change...

nvmnghia avatar Sep 20 '19 03:09 nvmnghia

I had the same issue with a brand new angular 7 project. Just Installed it, npm start and got the error: ERROR in multi ./src/styles.sass So I opened angular.json and:

          "styles": [
             "src/styles.sass"   <--  I had styles.scss file, not this styles.sass
           ],

I just renamed styles.sass to styles.scss because that file was present in the project folder and npm start again. This resolved my issue.

combine13 avatar Oct 18 '19 15:10 combine13

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.