如何调试角2的WebPack?(How to debug Angular 2 with webpac

2019-09-28 10:08发布

鉴于以下错误:

例外:未捕获(在承诺):类型错误:[对象的对象]仅具有吸气剂类型错误的无法设置属性堆栈:[对象的对象]的不能设置属性堆栈仅具有吸气

堆栈跟踪,我得到的是巨大的,我不知道这打字稿文件呛具有只读属性。 有没有一种方法,将告诉我,这是试图建立一个只有一个getter哪个属性?

一个快速和肮脏的解决办法是逐个删除代码,直到它的工作原理。 我将能够告诉我们,它是什么窒息的代码,其范围将是问题出现。 但是,如果从长远来看,该代码突然崩裂,那么他的一种解决方案是不理想的,我根本不知道是什么打破了它不看版本历史。

是否有一个工具,这将有助于我吗?

Error: Uncaught (in promise): TypeError: Cannot set property stack of [object Object] which has only a getter TypeError: Cannot set property stack of [object Object] which has only a getter at assignAll (http://localhost:3000/polyfills.bundle.js:16015:29) at ViewWrappedError.ZoneAwareError (http://localhost:3000/polyfills.bundle.js:16086:16) at ViewWrappedError.BaseError [as constructor] (http://localhost:3000/main.bundle.js:5256:16) at ViewWrappedError.WrappedError [as constructor] (http://localhost:3000/main.bundle.js:5318:16) at new ViewWrappedError (http://localhost:3000/main.bundle.js:57044:16) at CompiledTemplate.proxyViewClass.DebugAppView._rethrowWithContext (http://localhost:3000/main.bundle.js:79673:23) at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/main.bundle.js:79646:18) at CompiledTemplate.proxyViewClass.AppView.internalDetectChanges (http://localhost:3000/main.bundle.js:79433:18) at CompiledTemplate.proxyViewClass.View_ReportsComponent_Host0.detectChangesInternal (/ReportsModule/ReportsComponent/host.ngfactory.js:35:19) at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/main.bundle.js:79448:14) at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/main.bundle.js:79643:44) at ViewRef_.detectChanges (http://localhost:3000/main.bundle.js:57990:20) at RouterOutlet.activate (http://localhost:3000/main.bundle.js:63236:42) at ActivateRoutes.placeComponentIntoOutlet (http://localhost:3000/main.bundle.js:21937:16) at ActivateRoutes.activateRoutes (http://localhost:3000/main.bundle.js:21904:26) at http://localhost:3000/main.bundle.js:21840:58 at Array.forEach (native) at ActivateRoutes.activateChildRoutes (http://localhost:3000/main.bundle.js:21840:29) at ActivateRoutes.activateRoutes (http://localhost:3000/main.bundle.js:21910:22) at http://localhost:3000/main.bundle.js:21840:58 at Array.forEach (native) at ActivateRoutes.activateChildRoutes (http://localhost:3000/main.bundle.js:21840:29) at ActivateRoutes.activate (http://localhost:3000/main.bundle.js:21814:14) at http://localhost:3000/main.bundle.js:21382:22 at SafeSubscriber._next (http://localhost:3000/main.bundle.js:4169:25) at SafeSubscriber.__tryOrUnsub (http://localhost:3000/main.bundle.js:6028:16) at SafeSubscriber.next (http://localhost:3000/main.bundle.js:5977:22) at Subscriber._next (http://localhost:3000/main.bundle.js:5930:26) at Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at MapSubscriber._next (http://localhost:3000/main.bundle.js:23024:26) at MapSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at MergeMapSubscriber.notifyNext (http://localhost:3000/main.bundle.js:22890:30) at InnerSubscriber._next (http://localhost:3000/main.bundle.js:85350:21) at InnerSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at MapSubscriber._next (http://localhost:3000/main.bundle.js:23024:26) at MapSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at ReduceSubscriber._complete (http://localhost:3000/main.bundle.js:86357:30) at ReduceSubscriber.Subscriber.complete (http://localhost:3000/main.bundle.js:5919:18) at MergeMapSubscriber._complete (http://localhost:3000/main.bundle.js:22882:30) at MergeMapSubscriber.Subscriber.complete (http://localhost:3000/main.bundle.js:5919:18) at ArrayObservable._subscribe (http://localhost:3000/main.bundle.js:66973:24) at ArrayObservable.Observable.subscribe (http://localhost:3000/main.bundle.js:4131:27) at MergeMapOperator.call (http://localhost:3000/main.bundle.js:22832:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at ReduceOperator.call (http://localhost:3000/main.bundle.js:86316:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at MapOperator.call (http://localhost:3000/main.bundle.js:22995:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at Object.subscribeToResult (http://localhost:3000/main.bundle.js:46412:27) at MergeMapSubscriber._innerSub (http://localhost:3000/main.bundle.js:22877:38) at MergeMapSubscriber._tryNext (http://localhost:3000/main.bundle.js:22874:14) at MergeMapSubscriber._next (http://localhost:3000/main.bundle.js:22857:18) at MergeMapSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at MergeMapSubscriber.notifyNext (http://localhost:3000/main.bundle.js:22890:30) at InnerSubscriber._next (http://localhost:3000/main.bundle.js:85350:21) at InnerSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at MapSubscriber._next (http://localhost:3000/main.bundle.js:23024:26) at MapSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18) at EverySubscriber.notifyComplete (http://localhost:3000/main.bundle.js:67454:26) at EverySubscriber._complete (http://localhost:3000/main.bundle.js:67471:14) at EverySubscriber.Subscriber.complete (http://localhost:3000/main.bundle.js:5919:18) at MergeMapSubscriber._complete (http://localhost:3000/main.bundle.js:22882:30) at MergeMapSubscriber.Subscriber.complete (http://localhost:3000/main.bundle.js:5919:18) at ArrayObservable._subscribe (http://localhost:3000/main.bundle.js:66973:24) at ArrayObservable.Observable.subscribe (http://localhost:3000/main.bundle.js:4131:27) at MergeMapOperator.call (http://localhost:3000/main.bundle.js:22832:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at EveryOperator.call (http://localhost:3000/main.bundle.js:67434:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at MapOperator.call (http://localhost:3000/main.bundle.js:22995:23) at Observable.subscribe (http://localhost:3000/main.bundle.js:4128:22) at Object.subscribeToResult (http://localhost:3000/main.bundle.js:46412:27) at MergeMapSubscriber._innerSub (http://localhost:3000/main.bundle.js:22877:38) at MergeMapSubscriber._tryNext (http://localhost:3000/main.bundle.js:22874:14) at MergeMapSubscriber._next (http://localhost:3000/main.bundle.js:22857:18) at MergeMapSubscriber.Subscriber.next (http://localhost:3000/main.bundle.js:5894:18)

Answer 1:

更新

它固定于0.7.6

https://github.com/angular/zone.js/blob/master/CHANGELOG.md#076-2017-01-17

上一版本

降级zonejs到0.7.4 https://github.com/angular/zone.js/issues/595

npm install --save zone.js@0.7.4


Answer 2:

这样做的原因是缺少库或模块。 在你的模板一个你使用的是不知道的应用程序(尚未加载)一个指令;

我是如何解决这个。

  • 检查错误堆栈在浏览器

  • 然后检查方法:比如CompiledTemplate.proxyViewClass的当地人==>在那里,你可以看到这直接导致你丢失的指令有意义的错误消息

注释:此错误是不相关的“zone.js”; 也许如果你改变“zone.js”错误消息改版



文章来源: How to debug Angular 2 with webpack?