angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ERROR in : TypeError: Cannot read property 'kind' of undefined

Open rightisleft opened this issue 8 years ago • 6 comments

Versions

Angular CLI: 1.7.3
Node: 8.9.4
OS: darwin x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Repro steps

  • run npm run buildprod
  • executed ng build --prod --no-progress

Observed behavior

> ng build --prod --no-progress

Date: 2018-04-02T16:41:41.522Z
Hash: 64264ac9729ed922bc6d
Time: 22248ms
chunk {scripts} scripts.7f8b770a5f080be06e69.bundle.js (scripts) 159 kB [initial] [rendered]
chunk {0} styles.e3d827b8848de46fb3a2.bundle.css (styles) 1.23 MB [initial] [rendered]
chunk {1} polyfills.997d8cc03812de50ae67.bundle.js (polyfills) 84 bytes [initial] [rendered]
chunk {2} main.ee32620ecd1edff94184.bundle.js (main) 84 bytes [initial] [rendered]
chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]

ERROR in : TypeError: Cannot read property 'kind' of undefined
    at nodeCanBeDecorated (/app/node_modules/typescript/lib/typescript.js:7934:36)
    at nodeIsDecorated (/app/node_modules/typescript/lib/typescript.js:7954:16)
    at Object.nodeOrChildIsDecorated (/app/node_modules/typescript/lib/typescript.js:7958:16)
    at isDecoratedClassElement (/app/node_modules/typescript/lib/typescript.js:52074:23)
    at isInstanceDecoratedClassElement (/app/node_modules/typescript/lib/typescript.js:52065:20)
    at Object.filter (/app/node_modules/typescript/lib/typescript.js:1639:31)
    at getDecoratedClassElements (/app/node_modules/typescript/lib/typescript.js:52047:23)
    at generateClassElementDecorationExpressions (/app/node_modules/typescript/lib/typescript.js:52221:27)
    at addClassElementDecorationStatements (/app/node_modules/typescript/lib/typescript.js:52210:44)
    at visitClassDeclaration (/app/node_modules/typescript/lib/typescript.js:51535:13)
    at visitTypeScript (/app/node_modules/typescript/lib/typescript.js:51376:28)
    at visitorWorker (/app/node_modules/typescript/lib/typescript.js:51189:24)
    at sourceElementVisitorWorker (/app/node_modules/typescript/lib/typescript.js:51221:28)
    at saveStateAndInvoke (/app/node_modules/typescript/lib/typescript.js:51133:27)
    at sourceElementVisitor (/app/node_modules/typescript/lib/typescript.js:51203:20)
    at visitNodes (/app/node_modules/typescript/lib/typescript.js:49517:48)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] buildprod: `ng build --prod --no-progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] buildprod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-02T16_41_41_613Z-debug.log
/app #
/app # ng --version

Desired behavior

Should be able to use AOT

applying --aot=false fixes the issue

Mention any other details that might be useful (optional)

This was working on older version of angular 4.0

rightisleft avatar Apr 02 '18 16:04 rightisleft

https://github.com/typestack/class-transformer/issues/108

splincode avatar Apr 05 '18 12:04 splincode

These steps worked for me: 1)Clear package.json with the importat packages for example I have delete my package and insert one by one here is my

{ "name": "test-app", "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.1.0", "@angular/cdk": "^6.4.2", "@angular/common": "^6.1.0", "@angular/compiler": "^6.1.0", "@angular/core": "^6.1.0", "@angular/flex-layout": "^6.0.0-beta.17", "@angular/forms": "^6.1.0", "@angular/http": "^6.1.0", "@angular/material": "^6.4.2", "@angular/platform-browser": "^6.1.0", "@angular/platform-browser-dynamic": "^6.1.0", "@angular/router": "^6.1.0", "angular2-uuid": "^1.1.1", "chartist": "^0.11.0", "core-js": "^2.5.4", "jquery": "^3.3.1", "rxjs": "^6.0.0", "rxjs-compat": "^6.2.2", "webpack": "^4.16.3", "zone.js": "~0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.7.0", "@angular/cli": "^6.1.2", "@angular/compiler-cli": "^6.1.0", "@angular/language-service": "^6.1.0", "@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": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "npm-install-webpack-plugin": "^4.0.5", "protractor": "~5.3.0", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "^2.7.2", "webpack-cli": "^3.1.0", "webpack-dev-server": "^3.1.5" } } delete package_locked.json delete node_modules folder npm install Then ng build --prod was successful.

rodrigowindows avatar Aug 02 '18 00:08 rodrigowindows

Are you still able to reproduce this issue with the latest version?

mgechev avatar Dec 26 '18 19:12 mgechev

Closing as no further feedback was provided by the reporter.

If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.

alan-agius4 avatar Feb 05 '19 11:02 alan-agius4

this not solution for me

ERROR in : TypeError: Cannot read property 'kind' of undefined at checkNestedBlockScopedBinding

manjitha-teshara avatar Mar 16 '19 18:03 manjitha-teshara

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.