Error in multi styles
OS?
Windows 7 x64
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand 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.
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.
Have same issue.. Did you find any solution for this ?
@filipesilva :thanks...it works. So the path in angular-cli.json references to src/
@filipesilva Thanks that helped me fix my issue
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
@shaadh Its really silly that copy/pasted path throws an error. I had seen your comment 3 hours ago, but dint try. Finally I thought to give it a try and boom. Thank You!
I copy and pasted the bootstrap URL from another project that worked, but didn't work in my new project. Now fixed. node_module worked in the old project but in new project needed to be node_modules. In other words the folder structure was different for a new project to that of an old project, even though both were auto generated by Angular CLI.
A fix could be double checking that the URL you copied matches the location of the file you are referencing.
If you have this error in angular and angular-cli You should use like below: "../node_modules/bootstrap/dist/css/bootstrap.css" Because your Index.html and .angular-cli.json files are not in the same folder!
I had this problem but it was due to a simple typo in the angular.json - I had left "" as a style value in the projects
It's a good job I spotted it as the error message in this instance is useless. Incidentally, I don't have angular-cli-json file in my project !
Hello, I have this error, someone can help me? thanks ERROR in multi ../node_modules/bootstrap/dist/css/bootstrap.css ./src/styles.scss Module not found: Error: Can't resolve 'C:\Users\foued\node_modules\bootstrap\dist\css\bootstrap.css' in 'C:\Users\foued\mon-premier-projet'
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';
ERROR in multi ../node_modules/bootstrap/dist/css/bootstrap.min.css ./src/styles.css Module not found: Error: Can't resolve 'C:\xampp\htdocs\node_modules\bootstrap\dist\css\bootstrap.min.css' in 'C:\xampp\htdocs\Profile' i 「wdm」: Failed to compile. this error can occur in this bootstrap path...but when i change the path of bootstrap file then no error can occur. no error can occur with this path:- "node_modules/bootstrap/dist/css/bootstrap.min.css" Anyone can tell me the logic behind this why this happen??
You gotta use path that’s relative from to the main folder of your project.
I replaced this styles from angular.json "styles": ["src/styles.css"] to , "styles": ["styles.css"] It worked for me!
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.
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.
@anmolsrepo: 👍 You saved me from wasting a day.
Can we get this issue reopened? I also encountered the error on a clean install with v7.3
Thank you @anmolsrepo . That fixed the problem.