我正在将我的项目angular版本从4.4.7升级到最新版本。我更新了我的node.js到最新版本(8.11.1),也更新了angular cli到最新版本(1.7.4)。现在,当我用npm start运行代码时,这里是完整的错误。
core.es5.js:1020 ERROR Error: Uncaught (in promise): TypeError:
Cannot read property 'getGlobalEventTarget' of null
TypeError: Cannot read property 'getGlobalEventTarget' of null
at DomEventsPlugin.EventManagerPlugin.addGlobalEventListener
(platform-browser.es5.js:2474)
at EventManager.addGlobalEventListener (platform-browser.es5.js:2405)
at DefaultDomRenderer2.listen (platform-browser.es5.js:2912)
at BaseAnimationRenderer.listen (animations.es5.js:491)
at listenToElementOutputs (core.es5.js:9215)
at createViewNodes (core.es5.js:12159)
at createRootView (core.es5.js:12082)
at Object.createProdRootView [as createRootView] (core.es5.js:12756)
at ComponentFactory_.create (core.es5.js:9861)
at ComponentFactoryBoundToModule.create (core.es5.js:3333)
at DomEventsPlugin.EventManagerPlugin.addGlobalEventListener (platform-browser.es5.js:2474)
at EventManager.addGlobalEventListener (platform-browser.es5.js:2405)
at DefaultDomRenderer2.listen (platform-browser.es5.js:2912)
at BaseAnimationRenderer.listen (animations.es5.js:491)
at listenToElementOutputs (core.es5.js:9215)
at createViewNodes (core.es5.js:12159)
at createRootView (core.es5.js:12082)
at Object.createProdRootView [as createRootView] (core.es5.js:12756)
at ComponentFactory_.create (core.es5.js:9861)
at ComponentFactoryBoundToModule.create (core.es5.js:3333)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.es5.js:3881)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
2条答案
按热度按时间o2rvlv0m1#
请从子模块删除BrowserModule、BrowserAnimationsModule/NoopAnimationsModule的Angular 导入。并将这些导入包含在父模块中,就可以开始了。
wgx48brx2#
当我将自定义库导入我的angular应用程序时,我也遇到了同样的错误。错误(TypeError:无法读取从库生成文件引发的null的属性“getGlobalEventTarget”。
这个问题是由我在我的库中导入平台浏览器的方式引起的(websotrm自动建议)。
替换
与