我在控制台中收到以下错误:
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.
以下是我用来添加Bootstrap的代码:
npm install bootstrap@4.0.0 --save
然后我添加了bootstrap.css文件的路径:
path(/bootstrap/dist/css/bootstrap.css)
在style.css文件中
注意:我的服务器正在运行但我无法使用bootstrap。
答案 0 :(得分:1)
您实际上应该将其添加到您的.angular.cli.json
列表中
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
],
以下是更详细的Source
来源