Search code examples
jekyll

Possible to run jekyll serve --livereload on two different directories with two different ports at the same time?


I'm using jekyll serve --livereload on port 4000 (the default). It works. However, when I try to run the same command but on a different port with something like jekyll serve --livereload -P 4001, I get and error:

eventmachone.rb:351: 'start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)

Is there anyway to run --livereload on two different sites at the same time ?


Solution

  • You need to set 2 different ports. One for Jekyll and second for LiveReload.

    bundle exec jekyll serve --livereload --livereload-port 8080 --port 4001
    

    You will see the options that interest you by calling the command jekyll help serve:

    -P, --port [PORT]  Port to listen on
    --livereload-port [PORT]  Port for LiveReload to listen on