middleman / middleman-livereload

LiveReload support for Middleman
http://middlemanapp.com
MIT License
117 stars 37 forks source link

livereload not working on brand new middleman app? #96

Closed mehulkar closed 7 years ago

mehulkar commented 7 years ago

Hello! I installed and ran middleman for a new project, but livereload doesn't seem to be working out of box. Wondering if I have maybe gem version conflicts causing this?

In the browser console, I'm seeing:

Invalid url for WebSocket ws://:35729/livereload

Seems that the hostname "localhost" is missing from the we:// url?

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (5.0.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.5.0)
      public_suffix (~> 2.0, >= 2.0.2)
    backports (3.6.8)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    compass-import-once (1.0.5)
      sass (>= 3.2, < 3.5)
    concurrent-ruby (1.0.5)
    contracts (0.13.0)
    dotenv (2.2.0)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubis (2.7.0)
    eventmachine (1.2.3)
    execjs (2.7.0)
    fast_blank (1.0.0)
    fastimage (2.1.0)
    ffi (1.9.18)
    haml (4.0.7)
      tilt
    hamster (3.0.0)
      concurrent-ruby (~> 1.0)
    hashie (3.5.5)
    http_parser.rb (0.6.0)
    i18n (0.7.0)
    kramdown (1.13.2)
    listen (3.0.8)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    memoist (0.15.0)
    middleman (4.2.1)
      coffee-script (~> 2.2)
      compass-import-once (= 1.0.5)
      haml (>= 4.0.5)
      kramdown (~> 1.2)
      middleman-cli (= 4.2.1)
      middleman-core (= 4.2.1)
      sass (>= 3.4.0, < 4.0)
    middleman-cli (4.2.1)
      thor (>= 0.17.0, < 2.0)
    middleman-core (4.2.1)
      activesupport (>= 4.2, < 5.1)
      addressable (~> 2.3)
      backports (~> 3.6)
      bundler (~> 1.1)
      contracts (~> 0.13.0)
      dotenv
      erubis
      execjs (~> 2.0)
      fast_blank
      fastimage (~> 2.0)
      hamster (~> 3.0)
      hashie (~> 3.4)
      i18n (~> 0.7.0)
      listen (~> 3.0.0)
      memoist (~> 0.14)
      padrino-helpers (~> 0.13.0)
      parallel
      rack (>= 1.4.5, < 3)
      sass (>= 3.4)
      servolux
      tilt (~> 2.0)
      uglifier (~> 3.0)
    middleman-livereload (3.4.6)
      em-websocket (~> 0.5.1)
      middleman-core (>= 3.3)
      rack-livereload (~> 0.3.15)
    minitest (5.10.1)
    padrino-helpers (0.13.3.3)
      i18n (~> 0.6, >= 0.6.7)
      padrino-support (= 0.13.3.3)
      tilt (>= 1.4.1, < 3)
    padrino-support (0.13.3.3)
      activesupport (>= 3.1)
    parallel (1.11.1)
    public_suffix (2.0.5)
    rack (2.0.1)
    rack-livereload (0.3.16)
      rack
    rb-fsevent (0.9.8)
    rb-inotify (0.9.8)
      ffi (>= 0.5.0)
    sass (3.4.23)
    servolux (0.13.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.1.9)
      execjs (>= 0.3.0, < 3)

PLATFORMS
  ruby

DEPENDENCIES
  middleman
  middleman-livereload (~> 3.4)
  tzinfo-data
  wdm (~> 0.1.0)

BUNDLED WITH
   1.14.3
mehulkar commented 7 years ago

I'm able to add the host option to the activate :livereload command to fix this, so it sounds like either the default value is not being read or it is not set :)

mehulkar commented 7 years ago

One last piece of research: looks like https://github.com/middleman/middleman-livereload/blob/master/lib/middleman-livereload/extension_3_1.rb#L10 is returning ::1 on my machine instead of 0.0.0.0.