Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V 2.1.0: TypeError: Cannot read property 'kind' of undefined #69

Closed
egodefroy opened this issue Dec 31, 2019 · 17 comments
Closed

V 2.1.0: TypeError: Cannot read property 'kind' of undefined #69

egodefroy opened this issue Dec 31, 2019 · 17 comments

Comments

@egodefroy
Copy link

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)
@Cordobo Cordobo self-assigned this Dec 31, 2019
@Cordobo
Copy link
Owner

Cordobo commented Dec 31, 2019

@egodefroy Thanks for your bug report, could you please provide a working repo with which I can reproduce the issue?

compare #67

@albalooshi
Copy link

Hi, having the same issue with an ionic app, when running --prod.

@egodefroy
Copy link
Author

@Cordobo
see my repo : https://github.com/egodefroy/tstqr

@albalooshi
Copy link

solved the issue by downgrading to 1.6.4

@Cordobo
Copy link
Owner

Cordobo commented Jan 1, 2020

@Cordobo
see my repo : https://github.com/egodefroy/tstqr

I can't access the repo, I got a 404

@Cordobo
Copy link
Owner

Cordobo commented Jan 1, 2020

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?

"devDependencies": {
    "@angular-devkit/build-angular": "~0.803.21",
    "@angular-devkit/build-ng-packagr": "~0.803.21",
    "@angular/cli": "~8.3.21",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
...
}
  1. Reference: fix(@angular-devkit/build-optimizer): fix error when __decorate has… angular/angular-cli#15705

@egodefroy
Copy link
Author

@Cordobo
Thanks, this seems the right analysis. Using these dependencies, the error does not show!

@Cordobo
Copy link
Owner

Cordobo commented Jan 2, 2020

Ok, closing. Feel free to highlight my comment for other users with a smilie.

@Cordobo Cordobo closed this as completed Jan 2, 2020
@nicosoutn2014
Copy link

@Cordobo Hi! What about @angular/cli ~7.3.5? Any fixes?

@lance-h
Copy link

lance-h commented Jan 15, 2020

@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.

@Dianaman
Copy link

Got the same error and fixed it by downgrading the version, as stated above.
Please, try making the latest version compatible with the newest versions of angular in order to not lose functionalities.

@maelle9931
Copy link

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.

@Shaker1978
Copy link

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.

I agree. Version 2.x is declared to work with Angular 6/7/8/9 which is incorrect, because you have to use @angular-devkit/build-angular 0.8xx in order to build prod without errors. This again requires Angular 8. This finally leaves version 2.x unusable with Angular 6+7 in a prod environment.

@andreElrico
Copy link

I called

  • npm update (update to latest minor)
  • npm install @angular-devkit/build-angular@0.803.23
  • ng build --prod (works now)

Thanks to all other suggestions. Very helpful :-)

@PTC-JoshuaMatthews
Copy link

@andreElrico my issue was with a different library but it was throwing the same error, and the steps above got it working. Thanks!

@bacmanni
Copy link

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.

I agree. Version 2.x is declared to work with Angular 6/7/8/9 which is incorrect, because you have to use @angular-devkit/build-angular 0.8xx in order to build prod without errors. This again requires Angular 8. This finally leaves version 2.x unusable with Angular 6+7 in a prod environment.

You are right. Just got my code working and found this thread after wondering why my production build is broken. Page still says that 2.x is compatible with Angular 7.x but this is incorrect. @Cordobo please give us working fix or correct the documentation.

@Cordobo
Copy link
Owner

Cordobo commented Jul 2, 2020

Hi @ALL

I updated the readme to reflect the issue.

Repository owner locked as resolved and limited conversation to collaborators Jul 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests