Angular 2 个调试问题
Angular 2 debugging issues
我开始着手一个相当大的 angular 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)
我应该如何从这个错误消息中找出问题所在?有没有工具可以帮助理解这一点?
我遇到了同样的错误,可以通过将package.json中的zone.js版本升级到^0.7.4(任何大于0.7.4的版本)来查看上述错误的详细信息。
你也可以通过这个 npm 终端命令升级:
npm install --save zone.js@0.7.4
除此之外,我还使用 Intellij (JetBrains)、angular-cli 和 chrome,调试非常简单。
我开始着手一个相当大的 angular 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)
我应该如何从这个错误消息中找出问题所在?有没有工具可以帮助理解这一点?
我遇到了同样的错误,可以通过将package.json中的zone.js版本升级到^0.7.4(任何大于0.7.4的版本)来查看上述错误的详细信息。 你也可以通过这个 npm 终端命令升级:
npm install --save zone.js@0.7.4
除此之外,我还使用 Intellij (JetBrains)、angular-cli 和 chrome,调试非常简单。