CLI + Angular2 + C9 = Not Working


I’ve seen this topic posted a number of times on this forum but nothing has resolved the issue for me.

I install CLI and launch a new project using all of the generic commands on

When I launch ng serve or even ng serve --host --port 8080, I get “Invalid Host Header” when previewing.

A few websites have suggested: "ng serve --host --public-host but this isn’t working for me either. When I do this the website hangs (i.e. the preview pane shows that it’s loading the site indefinitely, without it actually ever loading).

Any other suggestions I can try? Node, NPM, CLI are all latest version. Thanks.


try using --disable-host-check flag

ng serve --host -port 8080 --disable-host-check


Thanks - but should have mentioned - already tried this with same result. Website loads (hangs) indefinitely.


I’ve tried running

npm install -g @angular/cli
ng new ng
cd ng
ng serve --host -port 8080 --disable-host-check

on an workspace with 1G ram, and it opened Welcome to app! page correctly.
So i think it must be either an error in the code you added, or ng serve running out of memory if your workspace have less than 1G.


I followed your exact series of steps, but had to additionally update Node to allow for cli to install:

nvm install 6
nvm alias default 6

Before trying anything, I deleted my workspace and started a new one, resizing it to include 1gb ram.

Same result. Preview pane loads continuously and shows blank.

Am I accessing the preview using the wrong URL? I’m just using the preview button at the top which gets me to



I’m mistaken. After doing everything I described in my previous post, the page took a couple of minutes to load, but ultimately did load. I think the resizing to 1gb space made the difference. Also now the live reload seems to be instant so the few minutes of load time seems to be a one-time phenomenon.

Thanks for the help harutyun.