4

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?

5 Answers 5

3

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
Sign up to request clarification or add additional context in comments.

Comments

2

I had the same problem with the latest version of Angular, today February 26, 2022 and I solved it by adding that version directly in the package.json, since the uninstall command did not remove the package inside node_modules

enter image description here

Comments

1

I had same issue when using npm install angular-datatables, it's install datatable version "angular-datatables": "^13.1.0"

So just downgrade the version of angular-datatables to 6.0.0

Install specific version of angular-datatables

  1. Delete node_modules
  2. npm install [email protected]

Comments

0

go to angular.json and downgrade to the version most person are using

this worked for me "angular-datatables": "^13.1.0", "bootstrap": "^5.2.1", "datatables.net": "^1.12.1", "datatables.net-bs5": "^1.11.3", "datatables.net-dt": "^1.11.3",

1 Comment

which version worked for you? if versions in existing answers worked for you, please vote them up instead of duplicating
0

The answer from triumlabs in https://github.com/l-lin/angular-datatables/issues/1248 worked for me. To be more specific, in my context, I opened the package.json and changed the "@types/datatables.net": "^1.10.21" to "@types/datatables.net": "~1.10.21" and It worked. I hope it works for u!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.