Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.

How to run angular cli on ec2 instance ng serve not working

Solution for error

Provided host xx.xx.xx.xx could NOT be bound. Please provide a different host address or hostname

If you run ng serve without giving correct port & correct public DNS you may get above error.

For any new developer hosting Angular application on AWS EC2 instance can be confusing some time.  Running ng serve starts the server but still your applicatoin is not running.

You need to check few thins in your EC2 instance

1. First check that port 4200 or any port that you want to use for Angular is added in security group to accept the traffic.

2. After allowing the port run ng serve with correct domain name or Public DNS shown in EC2 Instance for example "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"

 

Add On:

If you are getting this error with localhost:4200 you can try ng serve --host 0.0.0.0

To add specific port you can execute the command as follows: ng serve --host 0.0.0.0 -- port 4200

Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Menu

Comments

  • Sarat

    use ng serve --port 4202 --host 0.0.0.0 --publicHost ec2-your-public-host-link.com

    • Sarat
    • 4

Please share your views with us

Check if you want to display your email-id.

Let's collaborate

write to us

contact@ucodice.com

Contact Form