Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get guard-livereload to work #37

Closed
karl-petter opened this issue May 28, 2012 · 8 comments
Closed

Cannot get guard-livereload to work #37

karl-petter opened this issue May 28, 2012 · 8 comments

Comments

@karl-petter
Copy link

Hi,

I have installed guard-livereload according to https://github.com/guard/guard-livereload, i.e. added gem 'guard-livereload' to my Gemfile and did bundle install. Guard starts it(I see "LiveReload 1.6 is waiting for a browser to connect.") when guard is launched but none of my browsers seems able to connect!

Firefox, Chrome and Safari says: Could not connect to LiveReload server. Please make sure that LiveReload 2 (or another compatible server) is running. Using Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0, Chrome Version 19.0.1084.52 and Safari Version 5.1.7 (6534.57.2). I have installed the 2.08 extensions to all these browsers and from older closed issues I understood this combination should work, correct?

It seems it cannot find the server, cause in the Firefox error console I see an error message indicating it cannot connect to ws://127.0.0.1:35729/livereload.

And if I try to do "telnet localhost 35729" I get
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host

So there seems to be no server at that port. To make sure the server is started at that port I did configure this in the Guardfile:
guard 'livereload', :port => '35729'do but it does not help. Any ideas why the server isn't starting correctly or wont give any error messages?

@thibaudgg
Copy link
Member

Hi Karl,

Have you tried to set the host? :host => 127.0.0.1 the default is 0.0.0.0.

@karl-petter
Copy link
Author

Hi Thibaud,

thanks for the tip, but it didnt help :( I did some more research and with the aid of telnet I discovered it seems the LiveReload server is running but it seems to crash or something...

I turned off everything else in the Guardfile and just have this section:

guard 'livereload', :port => '35729', :host => '127.0.0.1' do
  watch(%r{app/views/.+\.(erb|haml|slim)})
  watch(%r{app/helpers/.+\.rb})
  watch(%r{public/.+\.(css|js|html)})
  watch(%r{config/locales/.+\.yml})
  # Rails Assets Pipeline
  watch(%r{(app|vendor)/assets/\w+/(.+\.(css|js|html)).*})  { |m| "/assets/#{m[2]}" }
end

If I then do bundle exec guard I get:

Guard uses Growl to send notifications.
Guard is now watching at '/users/kalle/coding/rails/oriboo-community/trunk'
LiveReload 1.6 is waiting for a browser to connect.

All seems ok so far. And if I try connect with a browser I get the error message it cannot connect. If I after that try to telnet to that port I get connection refused:

> telnet 127.0.0.1 35729
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

but if I restart guard again with bundle exec guard but do not try to connect with a browser but rather with telnet I get an interesting response:

> telnet 127.0.0.1 35729
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

So apparently there is server listening to that port when I start but it seems to crash or atleast stop listening. Is there any way to get a log from guard-livereload to investigate it further?

@thibaudgg
Copy link
Member

You can try to interact directly with the LiveReload reactor of guard-livereload. Normally all errors should be rescued.

@karl-petter
Copy link
Author

That was quite simple code, cannot really see why it shouldnt work. Think I need to investigate a bit more. Thanks!

@davidmarble
Copy link

I can't get guard-livereload to work either. Similar to above, though karl-petter seems to be on OS X and I'm on Ubuntu 12.04.

The EventMachine websocket server just seems to hang. I set the host to 127.0.0.1 explicitly in my Guardfile. Any way I try to access 127.0.0.1:35729 it just seems to hang. The extensions give me "haven't received a handshake reply in time, disconnecting." Any websocket test code in javascript just spins and spins trying to connect.

@thibaudgg
Copy link
Member

@davidmarble and the port is well configured in the client too? (I use rack-livereload client and it works fine)

@davidmarble
Copy link

Scratch that. Finally got it to work. Sad thing is I'm not sure which intermediate steps between yesterday and today made the difference (been tweaking a lot), but both the current javascript version provided by livereload-js as well as the Chrome extension work now. I set the host back to 0.0.0.0 is all I can think of.

@dopa
Copy link

dopa commented Feb 4, 2014

In case this helps anybody, my dumb mistake was I already had guard running for another project in another folder. I had to reboot but it started working for my second project when that was the first time I started guard. I also used bundle exec guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants