我遇到了麻烦,在rails项目(redmine2.3)中,rails版本是3.2
启动项目
bundle exec thin start -p 8080 -e production -s 5 -d
错误信息
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
/var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `require': libruby.so.2.0: cannot open shared object file: No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/rubyeventmachine.so (LoadError)
from /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `<top (required)>'
from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `require'
from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `<top (required)>'
from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `require'
from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `<top (required)>'
from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `load'
from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `<main>'
运行rails -v
rails -v
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
在项目中运行bundle exec .....
会产生相同的错误
答案 0 :(得分:8)
我在 Windows 10 上尝试使用 Jekyll 的 LiveReload 功能时遇到此错误消息。此处的其他答案并没有完全解决问题,或者有可能在下次运行 bundle install
时问题再次发生。
我的解决方案(取自 this site)是:
运行这个控制台命令
gem uninstall eventmachine
并选择从您的系统中卸载 eventmachine-1.2.7-x64-mingw32
gems。
在项目目录中编辑 Gemfile
并在其中添加以下行:
gem 'eventmachine', '1.2.7', git: 'https://github.com/eventmachine/eventmachine.git', tag: 'v1.2.7'
运行
execute bundle install
使用命令清理你的 jekyll 构建和缓存
bundle exec jekyll clean
您现在可以使用 --livereload
参数而不会出现任何问题,即使您将来执行 bundle install
。
答案 1 :(得分:4)
如果您使用的是Windows
转到此文件夹C:\Ruby24-x64\lib\ruby\gems\2.4.0\gems\eventmachine-1.2.5-x64-mingw32\lib
打开此文件eventmachine.rb
require 'em/pure_ruby'
写在文件的第一行代码中这将使其正常工作。
答案 2 :(得分:3)
此处的相关错误消息如下:
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
尝试重新安装eventmachine
gem:
gem uninstall eventmachine
bundle install
参见Rails/Ruby Error When Creating Database: Unable to load the EventMachine C extension 和 Rails - cannot run app: Unable to load the EventMachine C extension;有关如何处理此问题的更多建议。
答案 3 :(得分:1)
问题已解决。
rm vendor/cache/ -rf
bundle install
修正错误
remove the Redundant folder in the redmine/plugins
修正了警告
总而言之!答案 4 :(得分:1)
gem install eventmachine --platform ruby
答案 5 :(得分:0)
对于Windows 10上的Ruby 2.4和eventmachine 1.2.6。
您必须先卸载eventmachine
,然后再使用平台ruby再次安装它:
gem uninstall eventmachine (select all versions if prompted)
gem install eventmachine --platform ruby