0

when iam adding ngx date rangepicker module to my angular project,cannot build it. it failed with error:

ERROR in ./node_modules/ngx-daterangepicker-material/fesm5/ngx-daterangepicker-material.js Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js): TypeError: Cannot read property 'kind' of undefined

anybody know what is the problem??

georgeawg
  • 48,608
  • 13
  • 72
  • 95

3 Answers3

2

Finally I have the answer... this issue is with the new version of ngx-daterangepicker release. When I used a lower version, I could build with no issues. Thank you for your support.

Version -

"ngx-daterangepicker-material": "~2.0.2"
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
0

https://stackblitz.com/edit/angular-ngx-daterangepicker-material-build-problem

This is working while using ng serve but I build the entire angular app using ng build --prod and the issue was the following

"fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],

and as the stackblitz exports doesn't contian environments directory you should resolve the issue either by adding such files or comment this lines on angular.json

second problem was for old version of angular dependencies which stackblitz offers, so I updated them on packages.json to what ng new myApp generates.

"@angular/animations": "~9.0.1",
"@angular/common": "~9.0.1",
"@angular/compiler": "~9.0.1",
"@angular/core": "~9.0.1",
"@angular/forms": "~9.0.1",
"@angular/platform-browser": "~9.0.1",
"@angular/platform-browser-dynamic": "~9.0.1",
"@angular/router": "~9.0.1",

"@angular-devkit/build-angular": "~0.900.2",
"@angular/cli": "~9.0.2",
"@angular/compiler-cli": "~9.0.1",
"@angular/language-service": "~9.0.1",

"typescript": "~3.7.5"

finally it successfully build using ng build --prod

HoseinGhanbari
  • 1,058
  • 1
  • 11
  • 23
  • sorry bro i cannot update to this version(9.0) other componenents will have issues – akhil krishnan Feb 24 '20 at 12:24
  • try changing/updating `@angular-devkit/build-angular` package. it seems there might be something went wrong. – HoseinGhanbari Feb 24 '20 at 12:27
  • Package "ngx-datepicker-material" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0-rc.0 || ^6.0.0" (extended), would install "9.0.2"). how to fix it ??.can u help? – akhil krishnan Feb 24 '20 at 13:00
0

Fixed a very similar kind of problem I fixed by upgrading to

"@angular-devkit/build-angular": "^0.803.23",
Elikill58
  • 4,050
  • 24
  • 23
  • 45