Rashmi Choudhary
Rashmi Choudhary

Reputation: 53

Error "../node_modules/cdk-table-exporter/cdk-table-exporter.d.ts has no selector, please add it"when building angular application

I have installed the below dependency only for using mat-table-exporter in angular 8:

npm install mat-table-exporter --save 

Now when i am building my angular application using below command:

ng build --prod --build-optimizer --aot --base-href=/application_base_name

I get the error shown below:

PS C:\GitRepositories\cricket_aiops_dashboard\Client_Side>ng build --prod --build-optimizer --aot --base-href=/application_base_name
Your global Angular CLI version (9.1.0) is greater than your local
version (8.3.26). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

ERROR in Directive CdkTableExporter in C:/../Client_Side/node_modules/cdk-table-exporter/cdk-table-exporter.d.ts has no selector, please add it!

I tried to resolve it by installing dependency: npm install --save cdk-table-exporter and then build my application but it is not working even then.

Please find below contents of package.json

{
  "name": "ai-ops",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.conf.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "8.2.3",
    "@angular/cli": "^8.3.26",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@ng-bootstrap/ng-bootstrap": "^5.3.0",
    "@syncfusion/ej2-angular-calendars": "^17.4.51",
    "@syncfusion/ej2-vue-calendars": "^17.4.51",
    "@types/jquery": "^3.3.31",
    "angular-google-charts": "^0.1.6",
    "angular2-datatable": "^0.6.0",
    "angular2-datatable-pagination": "0.0.3",
    "angular2-prettyjson": "^3.0.1",
    "bootstrap": "^4.4.1",
    "core-js": "^2.6.11",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.5.0",
    "mat-table-exporter": "^9.0.0",
    "ng-multiselect-dropdown": "^0.2.10",
    "ngx-json-viewer": "^2.4.0",
    "ngx-toastr": "^11.2.1",
    "popper.js": "^1.16.1",
    "rxjs": "^6.5.3",
    "rxjs-compat": "^6.5.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.26",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.3",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.5.3"
  }
}

Please help!

Upvotes: 1

Views: 3174

Answers (2)

santonil2003
santonil2003

Reputation: 656

Check your angular version, if it is below 9 use [email protected]

npm install --save [email protected]

Upvotes: 2

SameerJadhav169
SameerJadhav169

Reputation: 11

If you are using Angular version below 9 you should use [email protected]. use this -> npm install --save [email protected]

if you already installed mat-table-exporter, uninstall it. first uninstall mat-table exporter and then uninstall cdk-table-exporter. and then install [email protected] using above command.

source - https://github.com/HalitTalha/mat-table-extensions/issues/49

hope it will help, cheers!!

Upvotes: 1

Related Questions