rubyinstaller2: Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
This project is for Ruby version 2.4 and newer. For Ruby versions < 2.4 please file an issue here.
What problems are you experiencing?
I keep getting this error message on the console even though I have the event machine gem installed and the require em/pure_ruby
Steps to reproduce
What’s the output from ridk version?
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require ‘em/pure_ruby’
C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- 2.4/rubyeventmachine (LoadError) from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require’
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5-x64-mingw32/lib/rubyeventmachine.rb:2:in <top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in require’
from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in require’
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5-x64-mingw32/lib/eventmachine.rb:8:in <top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in require’
from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in require’
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/faye-websocket-0.10.7/lib/faye/websocket.rb:10:in <top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in require’
from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in require’
from C:/Ruby24-x64/flutterbot/play.rb:3:in `<main>’
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (3 by maintainers)
Links to this issue
Commits related to this issue
- Use pure ruby em https://github.com/oneclick/rubyinstaller2/issues/96 — committed to devstopfix/elixoids by devstopfix 4 years ago
To solve the problem specified in the topic you need to run these commands:
gem uninstall eventmachine gem install eventmachine --platform ruby
Although eventmachine is provided as
x64-mingwplatform gem, it doesn’t support ruby-2.4 or 2.5 right now. So would recommend you to do the following:gem install eventmachine --platform rubyin the meantime.If you are using windows
Go to this folder
C:\Ruby24-x64\lib\ruby\gems\{version of ruby}\gems\eventmachine-1.2.5-x64-mingw32\libopen this file
eventmachine.rbwrite this
require 'em/pure_ruby'in the first line of code in the file this will make it work with no issues.Para os BRs: “Resolveu o meu problema”
@Neha5248
For Ruby 2.5 and later, try:
ridk exec pacman -Sy opensslupdates MSYS2 and installs the MSYS2 openssl package. This may take a little while…gem install eventmachine --platform=rubyinstalls EventMachine but forces compiling the gemEventMachine’s current x64-mingw32 gem is not compatible with Ruby 2.6 and later, and it was accidentally built without that information in the gemspec.
Ruby 2.5 and later use OpenSSL 1.1.1. Ruby 2.4 uses OpenSSL 1.0.2, which requires a different set of commands.
I have to check whether
EventMachineis defined beforerequire em/pure_rubyto prevent getting warnings.This problem always occurs … No convincing answer yet
I had that error when I run
bundle exec jekyll serve --livereload --traceon Jekyll.4.2.1-Ruby.3.0.3p137(mingw)-Windows. I rangem install eventmachine --platform=rubyand it compiled atC:\Ruby30-x64\lib\ruby\gems\3.0.0\gems\eventmachine-1.2.7but when you runbundle installit creates alsoC:\Ruby30-x64\lib\ruby\gems\3.0.0\gems\eventmachine-1.2.7-x64-mingw32🤔. The commandbundle info eventmachinegives meC:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/eventmachine-1.2.7-x64-mingw32and that’s confimed in the Gemfile.lock with the lineeventmachine (1.2.7-x64-mingw32). So I changed that line foreventmachine (1.2.7)and then the output ofbundle info eventmachinegives meC:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/eventmachine-1.2.7and finally the commandbundle exec jekyll serve --livereload --traceworked ✔️What worked for me on Apple Silicon M1 and Rails 6.1
gem uninstall -aIx eventmachinefollowed by arm -rf vendor/cachegem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git', :branch => 'master'bundle installFor those running into this problem with Jekyll’s live-reload (
bundle exec jekyll serve --livereload), I tried combining several of the above solutions:gem uninstall eventmachineand choose all to uninstallridk exec pacman -Sy openssl(run in Command Prompt, not Git Bash or some other shell)gem install eventmachine --platform rubyC:\Ruby27-x64\lib\ruby\gems\2.7.0\gems\eventmachine-1.2.7-x64-mingw32\lib\eventmachine.rbrequire 'em/pure_ruby' if not defined?(EventMachine)at the top of the fileThis ALMOST works, but it still crashes after a few reloads:
trace
Really wish this issue was fixed… upstream or wherever the problem lies.
EDIT: This solution actually seems to work for me. None of the above steps needed, just one line added to Gem file. It still seems to throw the same errors, but it doesn’t prevent the site from being refreshed.
I am having this problem when using
bundle exec jekyll s. Where would I apply your patch then?this works on my end.
@MSP-Greg
Thank a lot it’s working fine now 😃