2017-03-18 31 views
0

我有這個https://github.com/damirkusar/AngularMeetsNetCore/tree/AngularRc4項目,我使用的是Angular 4 RC.4和.net內核。當更新文件和應用程序通過熱模塊更換刷新,我得到以下錯誤:Angular 4 RC.4&.net core選擇器「app」與任何元素都不匹配

Unhandled Promise rejection: The selector "app" did not match any elements ; Zone: <root> ; Task: Promise.then ; Value: ZoneAwareError__zone_symbol__error: Error: The selector "app" did not match any elements 
    at DefaultDomRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:24029:19) [angular] 
    at DebugRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:12878:49) [angular] 
    at createElement (http://localhost:61234/dist/vendor.js:9171:23) [angular] 
    at createViewNodes (http://localhost:61234/dist/vendor.js:11672:44) [angular] 
    at createRootView (http://localhost:61234/dist/vendor.js:11619:5) [angular] 
    at callWithDebugContext (http://localhost:61234/dist/vendor.js:12727:42) [angular] 
    at Object.debugCreateRootView [as createRootView] (http://localhost:61234/dist/vendor.js:12204:12) [angular] 
    at ComponentFactory_.create (http://localhost:61234/dist/vendor.js:9591:46) [angular] 
    at ComponentFactoryBoundToModule.create (http://localhost:61234/dist/vendor.js:3490:29) [angular] 
    at ApplicationRef_.bootstrap (http://localhost:61234/dist/vendor.js:5024:57) [angular] 
    at http://localhost:61234/dist/vendor.js:4811:79 [angular] 
    at Array.forEach (native) [angular] 
    at PlatformRef_._moduleDoBootstrap (http://localhost:61234/dist/vendor.js:4811:42) [angular] 
    at http://localhost:61234/dist/vendor.js:4772:27 [angular]__zone_symbol__message: "The selector "app" did not match any elements"__zone_symbol__stack: "Error: The selector "app" did not match any elements↵ at DefaultDomRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:24029:19) [angular]↵ at DebugRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:12878:49) [angular]↵ at createElement (http://localhost:61234/dist/vendor.js:9171:23) [angular]↵ at createViewNodes (http://localhost:61234/dist/vendor.js:11672:44) [angular]↵ at createRootView (http://localhost:61234/dist/vendor.js:11619:5) [angular]↵ at callWithDebugContext (http://localhost:61234/dist/vendor.js:12727:42) [angular]↵ at Object.debugCreateRootView [as createRootView] (http://localhost:61234/dist/vendor.js:12204:12) [angular]↵ at ComponentFactory_.create (http://localhost:61234/dist/vendor.js:9591:46) [angular]↵ at ComponentFactoryBoundToModule.create (http://localhost:61234/dist/vendor.js:3490:29) [angular]↵ at ApplicationRef_.bootstrap (http://localhost:61234/dist/vendor.js:5024:57) [angular]↵ at http://localhost:61234/dist/vendor.js:4811:79 [angular]↵ at Array.forEach (native) [angular]↵ at PlatformRef_._moduleDoBootstrap (http://localhost:61234/dist/vendor.js:4811:42) [angular]↵ at http://localhost:61234/dist/vendor.js:4772:27 [angular]"message: (...)name: (...)ngDebugContext: DebugContext_ngErrorLogger:()originalStack: (...)stack: (...)toSource:()toString:()zoneAwareStack: (...)get message:()set message: (value)get name:()set name: (value)get originalStack:()set originalStack: (value)get stack:()set stack: (value)get zoneAwareStack:()set zoneAwareStack: (value)__proto__: Object Error: The selector "app" did not match any elements 
    at DefaultDomRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:24029:19) [angular] 
    at DebugRenderer2.selectRootElement (http://localhost:61234/dist/vendor.js:12878:49) [angular] 
    at createElement (http://localhost:61234/dist/vendor.js:9171:23) [angular] 
    at createViewNodes (http://localhost:61234/dist/vendor.js:11672:44) [angular] 
    at createRootView (http://localhost:61234/dist/vendor.js:11619:5) [angular] 
    at callWithDebugContext (http://localhost:61234/dist/vendor.js:12727:42) [angular] 
    at Object.debugCreateRootView [as createRootView] (http://localhost:61234/dist/vendor.js:12204:12) [angular] 
    at ComponentFactory_.create (http://localhost:61234/dist/vendor.js:9591:46) [angular] 
    at ComponentFactoryBoundToModule.create (http://localhost:61234/dist/vendor.js:3490:29) [angular] 
    at ApplicationRef_.bootstrap (http://localhost:61234/dist/vendor.js:5024:57) [angular] 
    at http://localhost:61234/dist/vendor.js:4811:79 [angular] 
    at Array.forEach (native) [angular] 
    at PlatformRef_._moduleDoBootstrap (http://localhost:61234/dist/vendor.js:4811:42) [angular] 
    at http://localhost:61234/dist/vendor.js:4772:27 [angular] 
consoleError @ vendor.js:100206 

當手動刷新應用程序,它加載和更新正確。

有沒有人看到問題是什麼,我必須改變? 感謝您的幫助。

+0

你可能想要通過你的package.json,並確保你的依賴關係是在適當的(最新)版本。具體來說,zone.js爲0.8.4;打字稿到2.2.1;還有其他人。這也可以解決你的其他問題。 –

+0

Hi @ R.Richards,感謝您的提示,但是這並沒有解決問題。已更新的軟件包已簽入。 – damir

+0

是的,你全部更新了它們。 :)錯誤仍然是一樣的?那裏沒有改變? –

回答

2

的問題是在boot-client.ts文件引起的在線路13:

module['hot'].dispose(() => { platform.destroy(); }); 
拆卸時

platform.destroy();它開始再次運作。所以這行應該看起來像這樣:

module['hot'].dispose(() => { }); 
相關問題