Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Module not found: Error: Can't resolve '@angular/cdk/scrolling'

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.

Error:

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       ],... 
like image 381
javapedia.net Avatar asked Apr 10 '19 09:04

javapedia.net


People also ask

Can t resolve'@ angular cdk scrolling in?

To solve the error "Module not found: Can't resolve '@angular/cdk/scrolling'", make sure to install the package by opening your terminal in your project's root directory and running the following command: npm i @angular/cdk and restart your IDE and development server.

What is angular CDK?

The Angular Component Dev Kit (CDK) is a library of predefined behaviors included in Angular Material, a UI component library for Angular developers. It contains reusable logic for many features that are used as common building blocks for the interfaces of Angular applications.


1 Answers

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

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

You can check it here:

  • Table: https://github.com/primefaces/primeng/blob/7.1.0/src/app/components/table/table.ts
  • Paginator: https://github.com/primefaces/primeng/blob/7.1.0/src/app/components/paginator/paginator.ts
  • Dropdown: https://github.com/primefaces/primeng/blob/7.1.0/src/app/components/dropdown/dropdown.ts
like image 150
Daniel Piñeiro Avatar answered Sep 28 '22 20:09

Daniel Piñeiro