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 init or load guard-livereload on Ruby 2.4.1/Windows #176

Open
soundasleep opened this issue Jul 22, 2017 · 4 comments
Open

Cannot init or load guard-livereload on Ruby 2.4.1/Windows #176

soundasleep opened this issue Jul 22, 2017 · 4 comments

Comments

@soundasleep
Copy link

It seems that guard-livereload isn't supported on the latest Ruby 2.4+ on Windows.

Putting this into my Gemfile, and running bundle works fine:

group :development do
  gem 'guard', require: false
  gem 'guard-livereload', '~> 2.5'
  gem 'guard-bundler'
end

But trying to initialise the Guardfile fails (note running just bundle exec guard init works fine):

C:\path>bundle exec guard init livereload
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
18:47:23 - INFO - Run 'gem install win32console' to use color on Windows
18:47:23 - ERROR - Could not load 'guard/livereload' or '~/.guard/templates/livereload' or find class Guard::Livereload

C:\path>ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]

C:\path>rails -v
Rails 5.1.2

If I use a different Guardfile that's already initialised, and run bundle exec guard, everything explodes:

C:\path>bundle exec  guard
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
18:49:06 - INFO - Run 'gem install win32console' to use color on Windows
18:49:06 - ERROR - Could not load 'guard/livereload' or find class Guard::Livereload
18:49:06 - ERROR - Error is: cannot load such file -- 2.4/rubyeventmachine
18:49:06 - ERROR - C:/Ruby/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.3-x64-mingw32/lib/rubyeventmachine.rb:2:in `require'
> [#] C:/Ruby/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.3-x64-mingw32/lib/rubyeventmachine.rb:2:in `<top (required)>'
> [#] C:/Ruby/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.3-x64-mingw32/lib/eventmachine.rb:8:in `require'
> ...
> [#] C:/Ruby/lib/ruby/gems/2.4.0/gems/guard-2.14.1/bin/_guard-core:11:in `<main>'
18:49:06 - ERROR - Invalid Guardfile, original error is:
> [#]
> [#] Could not load class: "Livereload",
> [#] backtrace:
> [#]   (dsl)> C
@soundasleep
Copy link
Author

It looks like it's something to do with my eventmachine/system setup. Adding require 'em/pure_ruby' into the Gemfile solves the issue. (Though there's probably a better place for it to go.)

@soundasleep
Copy link
Author

An even better workaround is simply to use an older version of eventmachine.

gem 'eventmachine', '1.0.9.1'

@gbadesimple
Copy link

gbadesimple commented May 8, 2020

This also happened to me on my Windows 10 machine. What i did was that, i copy and past require 'em/pure_ruby' into the Guardfile created and again
Run guard init livereload in your terminal.

The response should look something like:

Warning: you have a Gemfile, but you're not using bundler or RUBYGEMS_GEMDEPS
09:19:35 - INFO - livereload guard added to Guardfile, feel free to edit it

@rahalrazika
Copy link

This also happened to me on my Windows 10 machine. What i did was that, i copy and past require 'em/pure_ruby' into the Guardfile created and again
Run guard init livereload in your terminal.

The response should look something like:

Warning: you have a Gemfile, but you're not using bundler or RUBYGEMS_GEMDEPS
09:19:35 - INFO - livereload guard added to Guardfile, feel free to edit it
thank you so much

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