angular-datatables: Cannot find namespace 'DataTables'

I have imported everything right as per the documentation. I still get the error CANNOT FIND NAMESPACE DATATABLES.

"@ng-bootstrap/ng-bootstrap": "^2.0.0",
    "@ngx-translate/core": "^10.0.1",
    "angular-datatables": "^6.0.0",
    "bootstrap": "^4.1.1",
    "core-js": "^2.5.6",
    "datatables.net": "^1.10.16",
    "datatables.net-dt": "^1.10.16",
    "jquery": "^3.3.1",

If you can help me it would be great. Thank you. @l-lin

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (1 by maintainers)

Most upvoted comments

solved, npm i @types/datatables.net --save-dev

I was facing the same issue. What worked for me is install exactly the same version of @types/datatables.net as it is declared in node_modules\angular-datatables\package.json. In my case it was: “@types/datatables.net”: “~1.10.21” Note that even declaring ^1.10.21 did not work, only as ~1.10.21 !!

Hope it helps.

I have the same problem with angular-datatables version 7.0.0 with Angular 6 Fixed downgrade version of angular-datables to 6.0.0

npm uninstall angular-datatables npm install angular-datatables@6.0.0

This worked for me: npm install @types/datatables.net@1.10.21 --save-dev

import “datatables.net”;

@Ponusiva no, unfortunately this doesn’t work… huge project is one break caused by this problem 😕 Can you tell me which version of @types/datatables.net you have in your package.json? Thanks in advance

Have you found a solution ? I’m facing the same issue, and I can’t find any solution

– EDIT : In my case it didn’t work because the library “@types/datatables.net” is now deprecated. They removed the declaration file in the version 1.12.0. I forced the installation of the version 1.10.16, instead of @types/datatables.net: ^1.10.16 I now have @types/datatables.net: 1.10.16

solved, npm i @types/datatables.net --save-dev

Thanks a lot man. It really worked