错误:找不到模块:错误:无法解析“@angular/cdk/scrolling" [英] Error: Module not found: Error: Can't resolve '@angular/cdk/scrolling'

查看:88
本文介绍了错误:找不到模块:错误:无法解析“@angular/cdk/scrolling"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到错误:Module not found: Error: Can't resolve '@angular/cdk/scrolling'" 只要我在应用程序中添加 import TableModule from primeNG.模块.ts.为什么会抛出这个错误?我没有看到 primeNG 文档中提到的任何模块依赖 https://www.primefaces.org/primeng/#/table.

I am encountering the error: "Module not found: Error: Can't resolve '@angular/cdk/scrolling'" as soon as I add import TableModule from primeNG in app.module.ts. Why is this error is thrown? I don't see any module dependency mentioned in the primeNG documentation https://www.primefaces.org/primeng/#/table.

错误:

Failed to compile.

./node_modules/primeng/components/dropdown/dropdown.js
Module not found: Error: Can't resolve '@angular/cdk/scrolling' in '/Users/admin/angular/MovieApp/node_modules/primeng/components/dropdown'

        import {TableModule} from 'primeng/table';
    ...
    imports: [
        BrowserModule,
        AppRoutingModule,
        HttpClientModule,CarouselModule,FieldsetModule,BrowserAnimationsModule,LightboxModule,
        ScrollPanelModule,TableModule
      ],...

推荐答案

使用 npm install @angular/cdk --save 可以解决这个问题.

Using npm install @angular/cdk --save would resolve this.

它需要它,因为 p-table 使用 p-paginator,它使用 p-dropdown,这需要 cdk.

It needs it because the p-table uses the p-paginator which uses p-dropdown, which this needs the cdk.

您可以在这里查看:

这篇关于错误:找不到模块:错误:无法解析“@angular/cdk/scrolling"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆