Ruby on rails 在Windows上为现有ROR应用程序设置本地服务器的指南
我是ROR的新手,我正在尝试在本地服务器上运行现有的rails应用程序。但不知为什么,当我尝试迁移数据库时,它失败了。请参阅下面的完整跟踪 雷克流产了!LoadError:无法加载此类文件--eventmachine C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active\u support/dependencies.rb:293:inRuby on rails 在Windows上为现有ROR应用程序设置本地服务器的指南,ruby-on-rails,ruby,ruby-on-rails-3,ruby-on-rails-4,Ruby On Rails,Ruby,Ruby On Rails 3,Ruby On Rails 4,我是ROR的新手,我正在尝试在本地服务器上运行现有的rails应用程序。但不知为什么,当我尝试迁移数据库时,它失败了。请参阅下面的完整跟踪 雷克流产了!LoadError:无法加载此类文件--eventmachine C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active\u support/dependencies.rb:293:inrequire' C:/Ruby24-x64/lib/ruby/gems/2.
require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active\u-support/dependencies.rb:293:in
block-in-require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active\u support/dependencies.rb:259:inload\u dependencity'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active\u support/dependencies.rb:293:in
require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thin-1.7.2/lib/thin.rb:7:in'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:81:in
require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:81:in块(2级)中的require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:76:in
each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:76:inblock in require'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:65:in
each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler/runtime.rb:65:inrequire'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-1.16.4/lib/bundler.rb:114:in
require'
C:/promotracks/config/application.rb:7:in'
C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core\u ext/kernel\u require.rb:55:in
require'
C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core\u ext/kernel\u require.rb:55:inrequire'
C:/rails/Rakefile:4:in
'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:inload'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/rake_模块。rb:29:in
load_rakefile'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:703:inraw\u load\u rakefile'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:104:in
块加载_rakefile'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:186:instandard_exception_handling'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:103:in
load_rakefile'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:82:inblock in run'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:186:in
standard\u exception\u handling'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/lib/rake/application.rb:80:inrun'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/rake-12.3.1/exe/rake:27:in
'
C:/Ruby24-x64/bin/rake:23:inload'
C:/Ruby24-x64/bin/rake:23:in
'
(我安装了ruby、rails、gem和bundler)rails应用程序的要点与windows环境不兼容,因此只需切换到mac或linux即可。根据帖子中共享的日志: 虽然eventmachine是作为x64 mingw平台gem提供的,但它不支持ruby-2.4或2.5之前的版本,现在已经修复了。因此,我建议您执行以下操作: 首先,(在Windows+Ruby 2.4上)确保删除所有版本的eventmachine,例如
gem uninstall eventmachine
然后使用下面提到的命令重新安装:
gem install eventmachine --platform ruby
你的gem文件中有eventmachine吗?没有,我在gemfileadd
gem“eventmachine”中没有看到它
到您的Gemfile并运行bundle安装。我这么做了,但现在当我尝试rake db:migrate时,它抛出了这个错误LoadError:无法加载这样的文件--2.4/rubyeventmachine C:/promotracks rails/config/application.rb:7:in'C:/promotracks rails/Rakefile:4:in
'(通过使用--trace运行任务查看完整跟踪)您可以尝试将其作为gem安装eventmachine--platformruby