AOT build breaks core-js; TypeError: Cannot read property 'subscribe' of undefined
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.5.0
Node: 9.0.0
OS: linux x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.2
typescript: 2.6.1
webpack: 3.8.1
Repro steps.
- here’s my package.json file
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/cdk": "^5.0.0-rc0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.2",
"@swimlane/ngx-datatable": "^11.0.0",
"angular2-moment": "^1.7.0",
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.5.0",
"font-awesome": "^4.7.0",
"fuse.js": "^3.0.5",
"ngx-infinite-scroll": "^0.6.1",
"primeng": "^5.0.0-rc.0",
"rxjs": "^5.4.3",
"zone.js": "^0.8.17"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "^2.5.54",
"@types/node": "~8.0.25",
"codelyzer": "~4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.2.0",
"ts-node": "~3.3.0",
"tslint": "~5.8.0",
"typescript": "=2.6.1"
}
- ng build --prod
- serve the app
The log given by the failure.
core.js:1350 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'subscribe' of undefined
TypeError: Cannot read property 'subscribe' of undefined
at createDirectiveInstance (core.js:12015)
at createViewNodes (core.js:13449)
at callViewAction (core.js:13881)
at execComponentViewsAction (core.js:13790)
at createViewNodes (core.js:13477)
at callViewAction (core.js:13881)
at execComponentViewsAction (core.js:13790)
at createViewNodes (core.js:13477)
at createRootView (core.js:13339)
at callWithDebugContext (core.js:14740)
at createDirectiveInstance (core.js:12015)
at createViewNodes (core.js:13449)
at callViewAction (core.js:13881)
at execComponentViewsAction (core.js:13790)
at createViewNodes (core.js:13477)
at callViewAction (core.js:13881)
at execComponentViewsAction (core.js:13790)
at createViewNodes (core.js:13477)
at createRootView (core.js:13339)
at callWithDebugContext (core.js:14740)
at resolvePromise (zone.js:824)
at resolvePromise (zone.js:795)
at zone.js:873
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4620)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:192)
at drainMicroTaskQueue (zone.js:602)
at <anonymous>
Desired functionality.
looks like AOT build removes required dependencies, same build works when I run ng build --prod --aot=false
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'members' of undefined
One of the reasons this can happen is in you app module, you have an entry components which the build process can't find...
Read more >Teradata/covalent - Gitter
TypeError : Cannot read property 'subscribe' of undefined at TdNavigationDrawerComponent.ngOnInit (navigation-drawer.component.js:108) at ...
Read more >cannot read properties of undefined (reading 'id') angular
So if the reminders variable is logged from the ngOnInit , the *ngIf approach should work fine. Open side panel. Angular - ERROR...
Read more >Observables compared to other techniques - Angular
This makes observables useful for getting multiple values over time. Observables differentiate between chaining and subscription. Promises only have .then() ...
Read more >ERROR in Cannot read property &#039;length&
Hi,. i just tried to migrate to Angular 9 and followed the Instruction. But getting this mistake: ERROR in Cannot read property 'length'...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This seems like a bug but we’ll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via
ng new repro-app
and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.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.