【问题标题】:getting an error while running Bootstrap 4 with Angular 6 Application使用 Angular 6 应用程序运行 Bootstrap 4 时出错
【发布时间】:2018-08-24 09:40:22
【问题描述】:

我已经使用 Angular CLI 安装了 Bootstrap 4,但在运行应用程序后出现错误。

我已经更新angular.json文件如下:

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

我已经添加了@import '~bootstrap/dist/css/bootstrap.min.css'; style.css 文件。

但我仍然收到错误:

ERROR in multi ./src/styles.css ../node_modules/bootstrap/dist/css/bootstrap.min.css
Module not found: Error: Can't resolve '/Users/user/Projects/A4/node_modules/bootstrap/dist/css/bootstrap.min.css' in '/Users/user/Projects/A4/demo'

【问题讨论】:

  • 试试这个“node_modules/bootstrap/dist/css/bootstrap.min.css”。
  • 只需将其从angular.json 中的styles 数组中删除即可。您在style.css 中添加了bootstrap。无需重复此操作

标签: angular npm angular-ui-bootstrap angular-bootstrap


【解决方案1】:

去掉前面的'../'。

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

【讨论】:

  • 我做了,但我仍然面临同样的问题
猜你喜欢
  • 1970-01-01
  • 2019-07-09
  • 1970-01-01
  • 2019-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多