0

I am getting below error in Console:

Refused to apply style from 'http://localhost:4200/bootstrap/dist/css
/bootstrap.css' because its MIME type ('text/html') is not a supported 
stylesheet MIME type, and strict MIME checking is enabled. webpack-
internal:///../../../core/esm5/core.js:3857 Angular is running in the 
development mode. Call enableProdMode() to enable the production mode. 
localhost/:1 Refused to apply style from 'http://localhost:4200/bootstrap
/dist/css/bootstrap.css' because its MIME type ('text/html') is not a 
supported stylesheet MIME type, and strict MIME checking is enabled.

Below is the code that I use to add Bootstrap:

npm install bootstrap@4.0.0 --save

and then I add the path of bootstrap.css file:

path(/bootstrap/dist/css/bootstrap.css)

in style.css file

Note: My server is running but I am not able to use bootstrap.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Faiyaz Sayeed
  • 21
  • 1
  • 1
  • 3

1 Answers1

1

You actually should add it to your .angular.cli.json list this

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

Here is a source with more detail Source

  • Is bootstrap in the node_modules directory? If you ran the install in a different location it could have been installed in a different directory. Make sure that it is present in `/node_modules/bootstrap` – Lucas Desouza Feb 11 '18 at 16:55
  • Can you post your ‘.angular.cli.json’ file and your project file structure? – Lucas Desouza Feb 11 '18 at 19:27