Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in multi ./styles.css in Angular 6

I am new to Angular 6 ,In my project I got the below error

 ERROR in multi ./node_modules/bootstrap/dist/css/bootstrap.min.css ./styles.css
Module not found: Error: Can't resolve 'C:\Users\User\e-CommerceWebsite\styles.css' in 'C:\Users\User\e-CommerceWebsite'

and the browser shows

cannot Get

angular.json

 "styles": [
          "./node_modules/bootstrap/dist/css/bootstrap.min.css",
          "styles.css"
        ],
        "scripts": [
          "./node_modules/jquery/dist/jquery.min.js",
          "./node_modules/popper.js/dist/popper.min.js",
          "./node_modules/bootstrap/dist/js/bootstrap.min.js"
        ]

styles.css

@import '~bootstrap/dist/css/bootstrap.min.css';
...
...
...

Referred this : bootstrap not connect to the angular 6?

Can anyone help me to fix this error .

like image 656
Zhu Avatar asked Jun 26 '18 04:06

Zhu


4 Answers

In angular 6 angular.json file, use the bootstrap or font-awesome css file like this will fix your issue.

   "styles": [           {             "input": "./node_modules/bootstrap/dist/css/bootstrap.min.css"           },           {             "input": "./node_modules/font-awesome/css/font-awesome.min.css"           },           "src/styles.css"         ], 
like image 124
lupa Avatar answered Nov 03 '22 23:11

lupa


It basically takes the wrong path. We need to put the path as ../node_modules/bootstrap/dist/css/bootstrap.min.css instead of node_modules/bootstrap/dist/css/bootstrap.min.css.

like image 30
Pranendu Banerjee Avatar answered Nov 04 '22 01:11

Pranendu Banerjee


this work for me

  "styles": [
         {
            "input": "./node_modules/bootstrap/dist/css/bootstrap.min.css"
          },
          "src/styles.css"
        ],
like image 24
Shahid Avatar answered Nov 03 '22 23:11

Shahid


The only solution that worked for me:

1/   delete "node-modules"
2/   "npm install [email protected] --save"
3/   "npm install"
4/   "npm rebuild node-sass"
like image 45
kingabdr Avatar answered Nov 04 '22 00:11

kingabdr