I'm creating an angular2
clientside app with a node.js
server. clientside app seems to work perfectly fine, meaning that:
- All of my requests get proper responses.
- Application loads and works as expected.
but I get this error in terminal:
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)
which doesn't interrupt webpack
or http-server
.
The question is why I face this and how to resolve it?
I'm adding this answer for record as I described in comments too. This bug has been solved by fixing references to modules included in declaration list of
ngModule
.It was tricky to figure out the issue from the context of the error message. and also because of the code complexity it wasn't possible to include actual project code, but I figured out the issue while trying to make a simpler version ready to show here.