0
我正在使用node.js
服務器創建angular2
客戶端應用程序。客戶端應用程序似乎工作得很好,這意味着:錯誤:「應用程序」與任何元素都不匹配
- 我的所有請求都得到正確的響應。
- 應用程序加載和按預期工作。
,但我得到這個錯誤在終端:
Error: The selector "app" did not match any elements
at DomRenderer.selectRootElement (/home/mu-user/Projects/my-app/dist/server/index.js:27126:23)
at selectOrCreateRenderHostElement (/home/mu-user/Projects/my-app/dist/server/index.js:15687:32)
at AppView._View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:12:16)
at AppView.create (/home/mu-user/Projects/my-app/dist/server/index.js:50916:21)
at ComponentFactory.create (/home/mu-user/Projects/my-app/dist/server/index.js:36656:36)
at ApplicationRef_.bootstrap (/home/mu-user/Projects/my-app/dist/server/index.js:23313:40)
at /home/mu-user/Projects/my-app/dist/server/index.js:23222:89
at Array.forEach (native)
at Object.Call (/home/mu-user/Projects/my-app/node_modules/es6-shim/es6-shim.js:307:14)
at Array.forEach (/home/mu-user/Projects/my-app/node_modules/es6-shim/es6-shim.js:1313:17)
不中斷webpack
或http-server
。
問題是爲什麼我面對這個問題以及如何解決它?
你可以包含一些主文件嗎?像index.html,引導文件,模塊.. – echonax
這很可能是某種ngModule相關的問題,因爲你的應用程序不知道主要組件。你需要向我們展示一些我們可以幫助的代碼 –
@echonax這個項目包含50多個組件,幾乎不可能添加整個代碼,但恢復到較舊的提交以獲得更簡單的版本,我注意到錯誤消失了。所以它也沒有幫助。 – Reyraa