0
votes

I have tried to use bsdatepicker in my code, for that I have imported BsDatepickerModule from ngx-bootstrap. I am getting this error

ERROR in node_modules/ngx-bootstrap/chronos/utils/type-checks.d.ts(8,62): error TS2304: Cannot find name 'Extract'.

I have attached my package.json for your reference.

I have tried changing/updating versions of rxjs, could not fix it.

{
  "name": "notification-angular",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.2",
    "@angular/cdk": "^6.0.0",
    "@angular/common": "^6.0.2",
    "@angular/compiler": "^6.0.2",
    "@angular/core": "^6.0.2",
    "@angular/forms": "^6.0.2",
    "@angular/http": "^6.0.2",
    "@angular/material": "^6.0.2",
    "@angular/platform-browser": "^6.0.2",
    "@angular/platform-browser-dynamic": "^6.0.2",
    "@angular/router": "^6.0.2",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "bootstrap-material-design": "^4.1.1",
    "chart.js": "^2.7.2",
    "core-js": "^2.5.4",
    "font-awesome": "^4.7.0",
    "jquery": "^3.4.1",
    "ng2-completer": "^3.0.2",
    "ngx-bootstrap": "^4.3.0",
    "ngx-chips": "^2.0.2",
    "popper.js": "^1.14.3",
    "primeng": "^6.0.0-alpha.1",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.4",
    "@angular/cli": "~6.0.3",
    "@angular/compiler-cli": "^6.0.2",
    "@angular/language-service": "^6.0.2",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.12.0",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

I need to use bsdatepicker in my code without these errors.Error Screenshot

Output for ng version

Angular CLI: 6.0.3
Node: 11.12.0
OS: darwin x64
Angular: 6.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.12.4
@angular-devkit/build-optimizer   0.12.4
@angular-devkit/build-webpack     0.12.4
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cli                      6.0.3
@ngtools/webpack                  7.2.4
@schematics/angular               0.6.3
@schematics/update                0.6.3
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.28.4
2
Hi! can you update your question with what you get from the cli if you type ng -version from your root folder?Lucho
can you try first with updating your cli to 6.0.8 and then remove your node_modules folder and then do npm install again in your root folder?Lucho
I have tried as per you have told, I am getting the same error. @LuchoPrabhu Visu
can you update post again with the acutal bootstrap installed with npm list ngx-bootstrap?Lucho
Thanks for providing suggestions, I have fixed the error and I have specified in the answer section.@LPrabhu Visu

2 Answers

0
votes

You can use 'Ngx-DatePicker'.

npm install ngx-date-picker --save
0
votes

Thanks for your suggestions.!!

I have fixed the error in my code. I changed the ngx-bootstrap version to 2.0.5

sudo npm install [email protected]

Then the bsdatepicker was working without error, but the UI was not as expected. So,I included this line at the top of the component were I am using it.

<link rel="stylesheet" href="https://unpkg.com/ngx-bootstrap/datepicker/bs-datepicker.css">

Now, I got my expected output.!