我使用these instructions更新了现有项目的ember + ember-data版本,并且我在ember-data init进程中获得了一个无限循环。
ember版本:
ember-cli: 1.13.1
ember-data: 1.13.5
ember: 1.13.3
package.json和bower.json是我从ember-cli +我安装的一些软件包中得到的。我得到的无限循环是这个(来自chrome的堆栈跟踪):
.......
ember$data$lib$system$container$proxy$$ContainerProxy.aliasedFactory.create (container-proxy.js:22)
instantiate (ember.debug.js:1446)
lookup (ember.debug.js:1313)
buildInjections (ember.debug.js:1344)
injectionsFor (ember.debug.js:1396)
factoryFor (ember.debug.js:1373)
instantiate (ember.debug.js:1415)
lookup (ember.debug.js:1313)
Container.lookup (ember.debug.js:1245)
Registry.lookup (ember.debug.js:1666)
ember$data$lib$system$container$proxy$$ContainerProxy.aliasedFactory.create (container-proxy.js:22)
instantiate (ember.debug.js:1446)
lookup (ember.debug.js:1313)
buildInjections (ember.debug.js:1344)
injectionsFor (ember.debug.js:1396)
factoryFor (ember.debug.js:1373)
instantiate (ember.debug.js:1415)
lookup (ember.debug.js:1313)
Container.lookup (ember.debug.js:1245)
ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService (initialize-store-service.js:33)
(anonymous function) (ember.debug.js:4356)
(anonymous function) (ember.debug.js:4372)
visit (ember.debug.js:2241)
DAG.topsort (ember.debug.js:2352)
_emberRuntimeSystemNamespace.default.extend._runInitializer (ember.debug.js:4371)
_emberRuntimeSystemNamespace.default.extend.runInstanceInitializers (ember.debug.js:4354)
_emberRuntimeSystemNamespace.default.extend.didBecomeReady (ember.debug.js:4386)
Queue.invoke (ember.debug.js:903)
Queue.flush (ember.debug.js:967)
DeferredActionQueues.flush (ember.debug.js:767)
Backburner.end (ember.debug.js:160)
Backburner.run (ember.debug.js:228)
Backburner.join (ember.debug.js:263)
run.join (ember.debug.js:19526)
run.bind (ember.debug.js:19589)
jQuery.Callbacks.fire (jquery.js:3148)
jQuery.Callbacks.self.fireWith (jquery.js:3260)
jQuery.extend.ready (jquery.js:3472)
completed (jquery.js:3503)
lookup-and-aliasedFactory.create()部分无限重复,“store:main”实例化“srvice:store”和“service:store”从其init实例化“store:main”。
更具体地说,循环来自函数initializeStoreService()(在文件“initialize-store-service.js”中),它运行container.lookup('service:store');
这将调用'service:store'实例化,在ember-debug.js调用“hash [injection.property] = lookup(container,injection.fullName);” fullName是“store:main”...因为store:main还没有完成它的init,这会尝试再次实例化“store:main”,这会导致无限循环。
这是ember中的错误吗?我该如何解决?
谢谢!
更新: 显然,如果我这样做会发生:
application.inject('service', 'store', 'store:main');
在初始化程序中。这是非法的吗?