【问题标题】:ngx-bootstrap - Cannot find module 'ngx-bootstrap/component-loader'ngx-bootstrap - 找不到模块“ngx-bootstrap/component-loader”
【发布时间】:2019-04-26 22:55:18
【问题描述】:

我目前正在开发 Angular CLI 应用程序。几个小时前,我完成了一些部分,关闭项目,现在我想再次运行项目以继续我的工作。但是我没有成功编译项目,而是在 ngx-bootstrap 模块上出错。

    ERROR in node_modules/ngx-bootstrap/dropdown/bs-dropdown.directive.d.ts(2,40): error TS2307: Cannot find module 'ngx-bootstrap/component-loader'.
node_modules/ngx-bootstrap/dropdown/bs-dropdown.state.d.ts(2,32): error TS2307: Cannot find module 'ngx-bootstrap/component-loader'.
node_modules/ngx-bootstrap/public_api.d.ts(2,26): error TS2307: Cannot find module 'ngx-bootstrap/utils'.
node_modules/ngx-bootstrap/public_api.d.ts(3,95): error TS2307: Cannot find module 'ngx-bootstrap/accordion'.
node_modules/ngx-bootstrap/public_api.d.ts(4,58): error TS2307: Cannot find module 'ngx-bootstrap/alert'.
node_modules/ngx-bootstrap/public_api.d.ts(5,78): error TS2307: Cannot find module 'ngx-bootstrap/buttons'.
node_modules/ngx-bootstrap/public_api.d.ts(6,83): error TS2307: Cannot find module 'ngx-bootstrap/carousel'.
node_modules/ngx-bootstrap/public_api.d.ts(7,51): error TS2307: Cannot find module 'ngx-bootstrap/collapse'.
node_modules/ngx-bootstrap/public_api.d.ts(8,284): error TS2307: Cannot find module 'ngx-bootstrap/datepicker'.
node_modules/ngx-bootstrap/public_api.d.ts(9,133): error TS2307: Cannot find module 'ngx-bootstrap/modal'.
node_modules/ngx-bootstrap/public_api.d.ts(11,107): error TS2307: Cannot find module 'ngx-bootstrap/pagination'.
node_modules/ngx-bootstrap/public_api.d.ts(12,90): error TS2307: Cannot find module 'ngx-bootstrap/progressbar'.
node_modules/ngx-bootstrap/public_api.d.ts(13,47): error TS2307: Cannot find module 'ngx-bootstrap/rating'.
node_modules/ngx-bootstrap/public_api.d.ts(14,102): error TS2307: Cannot find module 'ngx-bootstrap/sortable'.
node_modules/ngx-bootstrap/public_api.d.ts(15,117): error TS2307: Cannot find module 'ngx-bootstrap/tabs'.
node_modules/ngx-bootstrap/public_api.d.ts(16,73): error TS2307: Cannot find module 'ngx-bootstrap/timepicker'.
node_modules/ngx-bootstrap/public_api.d.ts(17,91): error TS2307: Cannot find module 'ngx-bootstrap/tooltip'.
node_modules/ngx-bootstrap/public_api.d.ts(18,116): error TS2307: Cannot find module 'ngx-bootstrap/typeahead'.
node_modules/ngx-bootstrap/public_api.d.ts(19,91): error TS2307: Cannot find module 'ngx-bootstrap/popover'.
node_modules/ngx-bootstrap/public_api.d.ts(20,146): error TS2307: Cannot find module 'ngx-bootstrap/utils'.
node_modules/ngx-bootstrap/public_api.d.ts(21,85): error TS2307: Cannot find module 'ngx-bootstrap/component-loader'.
node_modules/ngx-bootstrap/public_api.d.ts(22,87): error TS2307: Cannot find module 'ngx-bootstrap/positioning'.
node_modules/ngx-bootstrap/public_api.d.ts(25,15): error TS2307: Cannot find module 'ngx-bootstrap/locale'.

我尝试安装 ngx-bootstrap 模块,但这无济于事。 有没有跟我一样的问题?

【问题讨论】:

  • 如何导入Bs DropdownModule?哪个角度版本?
  • 其实我只使用 import BsModalService 和 BsModalRef {BsModalRef, BsModalService} from 'ngx-bootstrap'; Angular CLI:1.6.8 节点:8.9.4 操作系统:win32 x64 Angular:5.2.11

标签: angular ngx-bootstrap


【解决方案1】:

将@angular/cli 和@angular/core 更新到v7 后,问题消失了。

Angular CLI:7.0.6 节点:8.9.4 操作系统:win32 x64 角度:7.1.0

【讨论】:

  • 请将您的回答标记为对问题的回答
  • 我在 Angular 8.2 版和 angular/cli 8.3 版中遇到此错误
【解决方案2】:

刚刚遇到同样的问题,但在我的情况下,我无法升级 Angular cli 或核心,可能一切都会崩溃......我通过降级来修复它

"ngx-bootstrap": "2.0.2"

以前使用过 "ngx-bootstrap": "^3.2.0" 会产生同样的问题。感谢您的提示。

【讨论】:

    猜你喜欢
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 2020-10-05
    • 2017-11-22
    • 2021-10-06
    • 1970-01-01
    • 1970-01-01
    • 2020-11-02
    相关资源
    最近更新 更多