rmosolgo / react-rails-hot-loader

Live-reload React.js components with Ruby on Rails & react-rails
MIT License
88 stars 26 forks source link

Doesn't work with Thin server #2

Closed ilyadoroshin closed 9 years ago

ilyadoroshin commented 9 years ago

When using thin server rails s just exits with no error explanation.

rmosolgo commented 9 years ago

Thanks for reporting this issue!

It looks like it was conflict between the gem's usage of EventMachine and Thin's usage of EventMachine.

Here's the commit to resolve that conflict: https://github.com/rmosolgo/react-rails-hot-loader/commit/7a655fe85a1ea41c09f0d103eae140ce34cacd5d

Could you pull the latest version (0.3.0) and let me know if it works for you?

ilyadoroshin commented 9 years ago

@rmosolgo :+1:

rmosolgo commented 9 years ago

:confetti_ball:

ilyadoroshin commented 9 years ago

Awesome, thanks!

ilyadoroshin commented 9 years ago

Unfortunately, it doesn't work. For some reason, when updating your component, EM tries to run server again, but it's already running. Thus, everything falls with error:

gems/ruby-2.1.6/gems/eventmachine-1.0.8/lib/eventmachine.rb:534:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)
        from /Users/idoroshin/.rvm/gems/ruby-2.1.6/gems/eventmachine-1.0.8/lib/eventmachine.rb:534:in `start_server'
        from /Users/idoroshin/.rvm/gems/ruby-2.1.6/gems/em-websocket-0.5.1/lib/em-websocket/websocket.rb:46:in `run'
rmosolgo commented 9 years ago

Oh interesting, I actually get that same error with Passenger, but I've ignored it because it doesn't actually break anything.

Guess it's time to fix it :P

ilyadoroshin commented 9 years ago

@rmosolgo yup ^_^

rmosolgo commented 9 years ago

Ok, moved error handling so that it would support my use of EM.next_tick: https://github.com/rmosolgo/react-rails-hot-loader/commit/12707c46575bf44badad4d8af4bd4e5d3d5d2f98#diff-9a8c3a912dd5b26d70f1088b2c07da50R60

Can you try it from master ?

ilyadoroshin commented 9 years ago

@rmosolgo looks, like it works! :sunglasses: thank you!

dmanjiri commented 7 years ago

I am facing this same error. When I change some js file and save it, the update reflects in the UI but the server stops abruptly. Error: gems/eventmachine-1.2.1/lib/eventmachine.rb:530:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)