'@ angular / common'中找不到导出'LOCATION_INITIALIZED'

时间:2017-02-26 20:31:26

标签: angular

我的角度2应用程序运行良好,直到今天早上我开始VS时遇到此错误消息

WARNING in ./~/@angular/router/src/router_module.js
303:51-71 "export 'LOCATION_INITIALIZED' was not found in '@angular/common'

以及以下

Unhandled Promise rejection: Token must be defined! ; Zone: <root> ; Task: Promise.then ; Value: Error: Token must be defined!
at new ReflectiveKey (reflective_key.js:36) [angular]
at KeyRegistry.get (reflective_key.js:89) [angular]
at Function.ReflectiveKey.get (reflective_key.js:54) [angular]
at ReflectiveInjector_.get (reflective_injector.js:325) [angular]
at AppModuleInjector.NgModuleInjector.get (ng_module_factory.js:140) [angular]
at RouterInitializer.appInitializer (router_module.js:303) [angular]
at new ApplicationInitStatus (application_init.js:30) [angular]
at AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:597) [angular]
at AppModuleInjector.NgModuleInjector.create (ng_module_factory.js:123) [angular]
at NgModuleFactory.create (ng_module_factory.js:91) [angular]
at :8080/dist/app.bundle.js:47522:61 [angular]
at Object.onInvoke (ng_zone.js:273) [angular] Error: Token must be defined!
at new ReflectiveKey (http://localhost:8080/dist/app.bundle.js:49098:19) [angular]
at KeyRegistry.get (http://localhost:8080/dist/app.bundle.js:49151:39) [angular]
at Function.ReflectiveKey.get (http://localhost:8080/dist/app.bundle.js:49116:35) [angular]
at ReflectiveInjector_.get (http://localhost:8080/dist/app.bundle.js:130453:102) [angular]
at AppModuleInjector.NgModuleInjector.get (http://localhost:8080/dist/app.bundle.js:69771:52) [angular]
at RouterInitializer.appInitializer (http://localhost:8080/dist/app.bundle.js:82228:48) [angular]
at new ApplicationInitStatus (http://localhost:8080/dist/app.bundle.js:47099:45) [angular]
at AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:597:36) [angular]
at AppModuleInjector.NgModuleInjector.create (http://localhost:8080/dist/app.bundle.js:69754:76) [angular]
at NgModuleFactory.create (http://localhost:8080/dist/app.bundle.js:69722:18) [angular]
at http://localhost:8080/dist/app.bundle.js:47522:61 [angular]
at Object.onInvoke (http://localhost:8080/dist/app.bundle.js:36376:37) angular]
consoleError @ zone.js:405
zone.js:407 Error: Uncaught (in promise): Error: Token must be defined!
Error: Token must be defined!
at new ReflectiveKey (reflective_key.js:36) [angular]
at KeyRegistry.get (reflective_key.js:89) [angular]
at Function.ReflectiveKey.get (reflective_key.js:54) [angular]
at ReflectiveInjector_.get (reflective_injector.js:325) [angular]
at AppModuleInjector.NgModuleInjector.get (ng_module_factory.js:140) [angular]
at RouterInitializer.appInitializer (router_module.js:303) [angular]
at new ApplicationInitStatus (application_init.js:30) [angular]
at AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:597) [angular]
at AppModuleInjector.NgModuleInjector.create (ng_module_factory.js:123) [angular]
at NgModuleFactory.create (ng_module_factory.js:91) [angular]
at :8080/dist/app.bundle.js:47522:61 [angular]
at Object.onInvoke (ng_zone.js:273) [angular]
at new ReflectiveKey (reflective_key.js:36) [angular]
at KeyRegistry.get (reflective_key.js:89) [angular]
at Function.ReflectiveKey.get (reflective_key.js:54) [angular]
at ReflectiveInjector_.get (reflective_injector.js:325) [angular]
at AppModuleInjector.NgModuleInjector.get (ng_module_factory.js:140) [angular]
at RouterInitializer.appInitializer (router_module.js:303) [angular]
at new ApplicationInitStatus (application_init.js:30) [angular]
at AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:597) [angular]
at AppModuleInjector.NgModuleInjector.create (ng_module_factory.js:123) [angular]
at NgModuleFactory.create (ng_module_factory.js:91) [angular]
at :8080/dist/app.bundle.js:47522:61 [angular]
at Object.onInvoke (ng_zone.js:273) [angular]
at resolvePromise (zone.js:486) [<root>]
at :8080/dist/polyfills.bundle.js:18027:17 [<root>]
at Zone.runTask (zone.js:151) [<root> => <root>]
at drainMicroTaskQueue (zone.js:418) [<root>]

应用程序在运行时编译和问题表面。我正在使用angular 2和typescript 2.1.6

2 个答案:

答案 0 :(得分:3)

如果其他人遇到此问题,@ angular / router(3.4.0)的最新版本与其他角度2依赖项不兼容,回滚到3.3.0可以解决问题。遗憾的是,这太熟悉了......

答案 1 :(得分:2)

好的,我让它恢复了工作。在启动VS时,它确实对某些软件包进行了一些更新。所以我取出了整个node_module文件夹并确保我有适当的软件包版本,并重新安装恢复了所有内容