You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Linux Ubuntu 16.04 LTS
Versions. Please run ng --version. If there's nothing outputted, please run
in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.11-webpack.2 (actually latest master at the time of this issue)
Repro steps. Was this an app that wasn't created using the CLI? What change did you
do on your code? etc.
None in particular
The log given by the failure. Normally this include a stack trace and some
more information.
Mention any other details that might be useful.
Is there a way to access the app from ng serve (either dev or prod variants) from another LAN device? Thanks.
Related to this PR: #1475 (comment)
That comment will show you how to access the server on other devices: ng serve --host 0.0.0.0
Reacted by Patrick Hillert, Tomeu, Heaven, Stanislav Mayorov, Tamal Kanti Nath, Dustin Hoffmann, Juan David Maldonado Gómez, Alexander Pavlyuk, Valter Barros, Robin and 154 more
Reacted by William Marques, Gowtham, Ana Clara Esponda, Dongmei, apurvtri, Tomislav Zorcec, Desheng Li, jocsa-pb, Edmond Chui, Colin Ng and 7 more
Reacted by Juan David Maldonado Gómez, Alexander Pavlyuk, Pratik Nagpure, Alouane Nour-Eddine, Víctor Adrián, Ivan Balukov, William Marques, Gowtham, Ana Clara Esponda, Dongmei and 32 more
Reacted by Ravin Singh D, codelovesme, William Marques, Gowtham, Juan Delgadillo, Ana Clara Esponda, Dongmei, rim1321, jyotendra sharma, Desheng Li and 22 more
@intellix I was thinking it was something about defining the listening interfaces. Thanks, exactly what I need and the original issue can be considered closed.
@kylecordes Even when angular-cli is based on ember-cli, can this (API) configuration be considered stable in the mid/long term?
For this that found this on Google, the best way to do this is to edit your package.json file and edit "start" and replace "ng serve" with @intellix amazing solution "ng serve --host 0.0.0.0". Then just start with "npm start". npm start will always be here ;D
Reacted by reza-iranmanesh, Ludger Peters, Makoto Mori, Adam, Julio Isaías, Pachito Marco Calabrese, zhantewei, Moobie, Gowtham, William and 22 more
Reacted by Semir, Gregory Zhukovsky, Kenmore Chalfant and Everson R R Moura
I still can't access it even when running on 0.0.0.0 :|
Reacted by Vittorio Morganti, Aleksandr Svetly, Vamsi Krishna, Alexandru Sfirlogea, Mahmoud Mouneer, Botond Balázs, Memeplexx, Florian Kappes, Moisă Anca-Elena, Peter Wilson and 2 more
@ShadowManu it doesn't work for me too. I set up the config correctly, but I can't reach the address (host unreachable) from any of the devices in the same LAN!
Reacted by William Desportes and Maxim Mazurok
Reacted by Oliver Hader, Jason Tay and João Eduardo Galli
Reacted by Valter Barros, Jorge Moliner, Brent Chow, Denis C de Azevedo, perfectlegend, Ivan Balukov, KJ JOSE, Volodymyr Kotushenko, Robin, Muhammad Nadzeri Munawar and 103 more
Reacted by Antonio, Shabbir Dhangot, Leo Picado, Emre Alparslan, Shoukath Mohammed, Shashwat Hiregoudar, Kamil Zieliński, Vittorio Morganti, StanislavSt, Michael Czechowski and 15 more
Reacted by Alexandru Sfirlogea, FlavioRossi, Jeffrey Reeves, Alex Szabó, Antonio, Szük Dániel, Bedini Fabio aka whisher , Shashwat Hiregoudar, Mohammad Kermani, Vittorio Morganti and 22 more
I have tried all of the above but none of them worked.
Anybody who has a proper solution other than above please comment and post an issue to the angular-cli community.
** I guess, we are running dev environment (webpack-dev-server) using ng serve which logically should not be accessible to anyone else while in dev.
I wanted to ask about the new angular.json file which replaced the .angular-cli.json. I used to override the host value there, but now i can not find how to override it. Does anyone has run into the same problem? Can you suggest me a solution other than writing host as parameter?
@sotiris-rafail I think what you are looking for is "dev-server" which has the "host" option. It looks like "host" is not available in the "server" section of the angular.json.
ng serve --host 0.0.0.0 is a security risk isn't it? Angular cli giving warning. I don't think we can use this for production deployment
> ng serve --host 0.0.0.0
WARNING: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.
Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
WebSocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
and with --disableHostCheck
WARNING: Running a server with --disable-host-check is a security risk. See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a for more information.
I follow all the possible solution from this page, and I can say I successfully accessed my application outside my localhost, but the problem is when I try to sign in, I cannot log in and I can't see what is the error. Is their any possible solution for this, might I missed something. by the way I am newbie here, hope you guys can support my query, thank you so much
angular-automatic-lock-bot commented on Sep 15, 2019
Activity
ShadowManu commentedon Aug 22, 2016
It wasn't working for me. Doesn't look like a local port/firewall issue since npm's
http-serverruns ok.intellix commentedon Aug 22, 2016
Related to this PR: #1475 (comment)
That comment will show you how to access the server on other devices:
ng serve --host 0.0.0.0kylecordes commentedon Aug 22, 2016
I do this on each new CLI project, to make
ng servelisted on all interfaces every time:ShadowManu commentedon Aug 22, 2016
@intellix I was thinking it was something about defining the listening interfaces. Thanks, exactly what I need and the original issue can be considered closed.
@kylecordes Even when
angular-cliis based onember-cli, can this (API) configuration be considered stable in the mid/long term?filipesilva commentedon Aug 23, 2016
Closed as the original issue is resolved.
I would not rely on long term support for
.ember-cli, no. Not even sure it'll work on the latest webpack version since we replaced the dev server.dylanh724 commentedon Dec 28, 2016
For this that found this on Google, the best way to do this is to edit your package.json file and edit "start" and replace "ng serve" with @intellix amazing solution "ng serve --host 0.0.0.0". Then just start with "npm start". npm start will always be here ;D
chrillewoodz commentedon Jan 31, 2017
I still can't access it even when running on
0.0.0.0:|ShadowManu commentedon Jan 31, 2017
@chrillewoodz remember the
--hostpart. It does work. It if doesn't its not on angular-cli part, check other suspects (routing, firewall, blah blah).toioski commentedon Jan 31, 2017
@ShadowManu it doesn't work for me too. I set up the config correctly, but I can't reach the address (host unreachable) from any of the devices in the same LAN!
ShadowManu commentedon Jan 31, 2017
@toioski I (and many more) can help out on the gitter channel, so we don't dirty up the thread.
osvaldo-github commentedon Feb 2, 2017
First verify your machine IP Address.
On Windows, type ipconfig in Prompt (copy IPv4).
On Mac, type ifconfig |grep inet in Terminal (copy inet).
In my case this is 192.168.0.10.
Next, type ng serve --host 192.168.0.10.
Ok, your app on air for all devices on same network.
Now only http://192.168.0.10:4200/ will work, localhost not more.
valterbarros commentedon Feb 3, 2017
@osvaldo-github only for complementing your answer is possible to change your hostname looks like a DNS
Windows
C:\Windows\System32\Drivers\Etc\hosts192.168.33.10 dev (Your IP and hostname what you want)
Linux
/etc/hostsahmed-musallam commentedon Mar 29, 2017
Since angular cli uses webpack-dev-server, using this
ng serve --host 0.0.0.0will pass the--hostoption to the webpack dev server. is this correct?shinde-prasad commentedon Aug 20, 2017
I have tried all of the above but none of them worked.
Anybody who has a proper solution other than above please comment and post an issue to the angular-cli community.
** I guess, we are running dev environment (webpack-dev-server) using ng serve which logically should not be accessible to anyone else while in dev.
May help: https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
9 remaining items
porfidev commentedon May 8, 2018
without use ng-cli
npm run start -- --host=0.0.0.0 --port=4500after first -- start all parameters for ng-cli as you need it.
pallapraveen commentedon May 9, 2018
run the command
ng serve --host=0.0.0.0 --disable-host-check
to disable host check and access with IPAddress
sotiris-rafail commentedon May 10, 2018
I wanted to ask about the new angular.json file which replaced the .angular-cli.json. I used to override the host value there, but now i can not find how to override it. Does anyone has run into the same problem? Can you suggest me a solution other than writing host as parameter?
ScottFred commentedon May 26, 2018
@sotiris-rafail I think what you are looking for is "dev-server" which has the "host" option. It looks like "host" is not available in the "server" section of the angular.json.
References
jyte commentedon Aug 17, 2018
For anyone looking on how to solve that with the new
angular.jsonfile, adding the"host": "0.0.0.0"line at the right place works for meankushthakur12 commentedon Sep 11, 2018
For mac:
naveedkamran commentedon Sep 24, 2018
I have the same issue and using npm run ng serve --host 0.0.0.0 does not allow it to be accessed on network. Though app is still accessible locally.
iampratapak commentedon May 16, 2019
ng serve --host 0.0.0.0 is a security risk isn't it? Angular cli giving warning. I don't think we can use this for production deployment
and with --disableHostCheck
rovertzxd commentedon May 23, 2019
@naveedkamran
if you are runing from npm you'll need to add two more hipens after ng serve.
Like this
npm run ng serve -- --host=0.0.0.0juanmendes commentedon Jun 13, 2019
@pratapgowda007 You shouldn't be using ng's dev server for production, not sure what you mean
jkatnik commentedon Aug 11, 2019
update to @jyte answer - solution for angular 7 changed to
JeffreyXieCn commentedon Aug 14, 2019
Doesn't work for me in Angular 8. But @jyte 's answer works for me in Angular 8.
cnbalbin commentedon Aug 15, 2019
I follow all the possible solution from this page, and I can say I successfully accessed my application outside my localhost, but the problem is when I try to sign in, I cannot log in and I can't see what is the error. Is their any possible solution for this, might I missed something. by the way I am newbie here, hope you guys can support my query, thank you so much
angular-automatic-lock-bot commentedon Sep 15, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.