Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facing error while using angular-datatables

I'm on ubuntu 20.04, with npm 6.14.15, node v14.17.2 and Angular CLI: 11.2.14. I tried to create data table into my working directory using angular-datatables module.

in order to use this angular-datatables module, i had installed following packages.

npm install jquery --save
npm install datatables.net --save
npm install datatables.net-dt --save
npm install angular-datatables --save
npm install @types/jquery --save-dev
npm install @types/datatables.net --save-dev

after i run the server, angular cli throw following of errors.

Error Message

Error: node_modules/angular-datatables/src/angular-datatables.directive.d.ts:39:21 - error TS2694: Namespace '"/home/nanthu/xxxxxx/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

39     static ɵfac: i0.ɵɵFactoryDeclaration<DataTableDirective, never>;
                       ~~~~~~~~~~~~~~~~~~~~


Error: node_modules/angular-datatables/src/angular-datatables.directive.d.ts:40:21 - error TS2694: Namespace '"/home/nanthu/xxxxxx/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.

40     static ɵdir: i0.ɵɵDirectiveDeclaration<DataTableDirective, "[datatable]", never, { "dtOptions": "dtOptions"; "dtTrigger": "dtTrigger"; }, {}, never>;
                       ~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/angular-datatables/src/angular-datatables.module.d.ts:13:21 - error TS2694: Namespace '"/home/nanthu/xxxxxx/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

13     static ɵfac: i0.ɵɵFactoryDeclaration<DataTablesModule, never>;
                       ~~~~~~~~~~~~~~~~~~~~


Error: node_modules/angular-datatables/src/angular-datatables.module.d.ts:[93m14:21 - error TS2694: Namespace '"/home/nanthu/xxxxxx/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.

14     static ɵmod: i0.ɵɵNgModuleDeclaration<DataTablesModule, [typeof i1.DataTableDirective], [typeof i2.CommonModule], [typeof i1.DataTableDirective]>;
                       ~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/angular-datatables/src/angular-datatables.module.d.ts:15:21 - error TS2694: Namespace '"/home/nanthu/xxxxxx/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.

15     static ɵinj: i0.ɵɵInjectorDeclaration<DataTablesModule>;

How do I resolve this issue to get Angular datatable?

like image 403
Nanthagopal nanthu Avatar asked Oct 13 '25 10:10

Nanthagopal nanthu


1 Answers

I had the same issue. You need to uninstall datatable and install a version lower than what you have installed. In both our case the datatable version was 13.0.0. I uninstalled this and installed a lower version.

npm uninstall angular-datatables
npm install [email protected]
npm start
like image 151
Jijo Robin Avatar answered Oct 14 '25 23:10

Jijo Robin