我开始使用一个相当大的角度2项目并且调试起来很困难。我正在使用Angular-CLI,WebStorm和Chrome。
每当我遇到问题时,首先我的IDE无法捕获打字稿的任何问题。无论问题是什么,浏览器总是显示此错误大约15次,可能是因为我的代码中出现语法错误,注入错误,构造函数问题或标记问题。
EXCEPTION: Uncaught (in promise): TypeError: Cannot set property 'stack' of undefined
TypeError: Cannot set property 'stack' of undefined
at NoProviderError.set [as stack] (http://localhost:4200/vendor.bundle.js:6147:61)
at assignAll (http://localhost:4200/vendor.bundle.js:98290:29)
at NoProviderError.ZoneAwareError (http://localhost:4200/vendor.bundle.js:98361:16)
at NoProviderError.BaseError [as constructor] (http://localhost:4200/vendor.bundle.js:6109:16)
at NoProviderError.AbstractProviderError [as constructor] (http://localhost:4200/vendor.bundle.js:58296:16)
at new NoProviderError (http://localhost:4200/vendor.bundle.js:58345:16)
at ReflectiveInjector_._throwOrNull (http://localhost:4200/vendor.bundle.js:79884:19)
at ReflectiveInjector_._getByKeyDefault (http://localhost:4200/vendor.bundle.js:79921:25)
at ReflectiveInjector_._getByKey (http://localhost:4200/vendor.bundle.js:79871:25)
at ReflectiveInjector_.get (http://localhost:4200/vendor.bundle.js:79633:21)
at AppModuleInjector.NgModuleInjector.get (http://localhost:4200/vendor.bundle.js:59199:52)
at CompiledTemplate.proxyViewClass.AppView.injectorGet (http://localhost:4200/vendor.bundle.js:80642:45)
at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet (http://localhost:4200/vendor.bundle.js:81070:49)
at ElementInjector.get (http://localhost:4200/vendor.bundle.js:80150:27)
at ReflectiveInjector_._getByKeyDefault (http://localhost:4200/vendor.bundle.js:79918:24)
我该如何从这条错误消息中找出问题?有没有工具可以帮助理解这个?
答案 0 :(得分:3)
我遇到了同样的错误,通过将package.json中的zone.js版本升级到^ 0.7.4(任何大于0.7.4版本的版本),可以看到上述错误的详细信息。 您也可以通过此npm terminal命令进行升级:
npm install --save zone.js@0.7.4
除此之外,我使用Intellij(JetBrains),angular-cli和chrome,调试非常简单。