# Bug in ionic 5's "stack-controller.ts"

**URL:** <https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041>\
**Category:** Ionic Framework\
**Created:** [September 10, 2020, 9:36pm UTC](https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041 "2020-09-10T21:36:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![turnono](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@turnono](https://forum.ionicframework.com/u/turnono)\
**Post date:** [September 10, 2020, 9:36pm UTC](https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041/1 "2020-09-10T21:36:42Z")

</div>

Error: Uncaught (in promise): TypeError: Cannot read property ‘appendChild’ of undefined  
TypeError: Cannot read property ‘appendChild’ of undefined  
at StackController.transition (stack-controller.ts:274)  
at stack-controller.ts:145  
at StackController.\_callee2$ (stack-controller.ts:296)  
at tryCatch (runtime.js:45)  
at Generator.invoke [as \_invoke] (runtime.js:274)  
at Generator.prototype. [as next] (runtime.js:97)  
at fulfilled (tslib.es6.js:71)  
at ZoneDelegate.invoke (zone.js:386)  
at Zone.run (zone.js:143)  
at zone.js:891  
at resolvePromise (zone.js:832)  
at resolvePromise (zone.js:784)  
at zone.js:894  
at ZoneDelegate.invokeTask (zone.js:421)  
at Object.onInvokeTask (core.js:27428)  
at ZoneDelegate.invokeTask (zone.js:420)  
at Zone.runTask (zone.js:188)  
at drainMicroTaskQueue (zone.js:601)  
at ZoneTask.invokeTask (zone.js:507)  
at ZoneTask.invoke (zone.js:492)

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [September 10, 2020, 9:39pm UTC](https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041/2 "2020-09-10T21:39:45Z")

</div>

That’s deep within routing animation. Something is amiss with your routing setup, or how you’re transitioning between pages.

---

<div class="post-metadata">

**Author:** ![guidoBlocki](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/guidoblocki/32/142974_2.png) [@guidoBlocki](https://forum.ionicframework.com/u/guidoBlocki)\
**Post date:** [August 17, 2022, 1:10pm UTC](https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041/3 "2022-08-17T13:10:45Z")

</div>

Hi!  
Did I find the solution to the problem? because I am with the same error at the moment.

---

<div class="post-metadata">

**Author:** ![nolly](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@nolly](https://forum.ionicframework.com/u/nolly)\
**Post date:** [October 17, 2024, 3:41am UTC](https://forum.ionicframework.com/t/bug-in-ionic-5s-stack-controller-ts/196041/4 "2024-10-17T03:41:28Z")

</div>

I’ve been running into this same exact error for over a year now and I’ve finally found the issue. For me it was occurring after you close a modal, then navigate to another page or view. The issue had to do with IonRouterOutlet. After removing that from the providers directive, as well as the imports, for both the modal as well as the initial page, I finally got the navigation to work properly.
