angularx-qrcode: V 2.1.0: TypeError: Cannot read property 'kind' of undefined
when running
ng build --prod
with this set of packages
{
"name": "create",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"startWithProxy": "ng serve --host 0.0.0.0 --disableHostCheck true --proxy-config proxy.config.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/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/flex-layout": "^8.0.0-beta.27",
"@angular/forms": "~8.2.14",
"@angular/material": "^8.2.3",
"@angular/material-moment-adapter": "^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.1.4",
"ajv": "^6.10.2",
"angularx-qrcode": "^2.1.0",
"core-js": "^3.6.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ngx-color-picker": "^8.2.0",
"rxjs": "^6.5.4",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.6",
"@angular/cli": "~8.0.6",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.0.3",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~8.9.4",
"codelyzer": "^5.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.4.5"
}
}
This error happens
ERROR in ./node_modules/angularx-qrcode/fesm5/angularx-qrcode.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined
at isAngularDecoratorMetadataExpression (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
at visitNodes (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16514:30)
at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16740:24)
at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16635:21)
at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16692:24)
at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16703:24)
at checkNodeForDecorators (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/Users/egylis/eclipse-workspace/Formation/NGFormation/create/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16599:21)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (5 by maintainers)
Ok, what I’ve read so far, it could be an issue with an older @angular dependency (1) used in your package.json. I run ng build --prod with the following devDependencies and can’t reproduce the error. Coiuld you try updating your dependencies to the ones below?
@nicosoutn2014 I am using @angular/cli ^7.2.2 - I downgraded angularx-qrcode to ^1.6.4 which removed the issue for me. Be aware that the documentation is slightly different between versions.
I called
Thanks to all other suggestions. Very helpful 😃
The fix proposed on this thread only works for Angular 8+. This component is supposed to be compatible with Angular 7. Please provide a fix for Angular 7.
@andreElrico my issue was with a different library but it was throwing the same error, and the steps above got it working. Thanks!