Search code examples
angularportnpm-live-server

Using LiveServer on port 8080


I'm currently working through the Angular 2 QuickStart instructions at https://angular.io/docs/js/latest/quickstart.html and have run into a problem running LiveServer. When I start LiveServer as per the instructions, I get an error in my brower:

Error Code: 502 Proxy Error

I've realised with a bit of investigation that my proxy is using port 8080 and so is LiveServer. If I turn my proxy off, then I can see the angular site in my browser.

So, my question is, what is the best port to change LiveServer to use?


Solution

  • I found the answer to my question in the live-server README file (which I probably should have read before posting the question) which says:

    If a file ~/.live-server.json exists it will be loaded and used as default options for live-server on the command line

    So, for the benefit of anyone else who needs to do this, I've created a .liver-server.json file and set the port to 8081 like this:

    {"port": 8181, 
    "host": "0.0.0.0", 
    "open": false, 
    "root":"/Users/abc/Projects/angular2-quickstart",
    "ignore": "",
    "file": "index.html",
    "wait": 1000 }
    

    This has worked.