How can you specify UI port for lite-server?
Asked Answered
P

2

12

When you start up lite-server, you can specify port for example

lite-server -- port 8000

Which gives you the following result:

[BS] Access URLs:
 ------------------------------------
       Local: http://localhost:8000
    External: http://192.168.0.5:8000
 ------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.0.5:3001

How can I change the port for UI which is 3001 by default (either command line and/or in bs-config.json file), to like 8001?

Panamerican answered 19/2, 2016 at 23:12 Comment(3)
github.com/johnpapa/lite-server#custom-configuration ...Olomouc
Thanks for the link, but it doesn't explain how to change the UI port - only the Local port which I have set in the example with -- port 8000 tagPanamerican
Yeah, sorry, my bad.Olomouc
P
18

Since lite-server uses browsersync, it can be changed via BrowserSync options

Not sure about command line parameter, but bs-config.json works like this:

{
  "port": 8000,
  "files": ["./dist/**/*.{html,htm,css,js}"],
  "server": { "baseDir": "./" },
  "ui": {
    "port": 8001
  }
}

BrowserSync command line options (that also work with lite-server)

Panamerican answered 20/2, 2016 at 1:1 Comment(0)
D
16

Just to add, for slow thinkers like me, to run lite-server on different port, create file bs-config.json in root of your project (or wherever you are running lite-server from) and add this into your bs-config.json

{
    "port": 8080
}

this will run lite server on port 8080

alternatively you can just pass path of the bs-config.json on running lite-server

lite-server -c configs/my-bs-config.json

source: https://github.com/johnpapa/lite-server#custom-configuration

Diva answered 24/1, 2017 at 20:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.