好的,所以我一直在为 Ruby 和 RoR 设置我的 IDE 环境。到目前为止,我已经能够解决的每一个问题,除了一个,所以我谦虚地向强大的 stackoverflow 寻求指导。
我的 RubyMine 安装无法识别某些已安装的 gem,或者更具体地说,SQLite3、Mysql 和 Mysql2。在 RubyMine 上使用 Gem 快速安装在所有三个上都失败了,但是,在 cmd 中使用正确的配置安装 gems 是成功的。虽然这是成功的,但 RubyMine 不能或不会识别已安装的 gem。'require mysql2'(在其前面放置了'require rubygems')直接失败,RubyMine 声明它无法加载这样的文件。通过 Firefox 访问 localhost 上的 RoR 服务器时,我收到一条错误消息,指出未加载 gem,我应该将其添加到我的 Gemfile 中(此时我应该说明所有上述 gem 都已经在 gemfile 中,如果不是我添加它们并运行捆绑安装),这令人困惑。我' 我花了几天时间在互联网和 stackoverflow 上寻找解决方案,但似乎没有任何效果。我什至尝试从 ruby 2 的 64 位版本到 32 位版本和一些以前的版本。
顺便说一句,在 linux 发行版中编写 ruby 代码会更容易吗?(如 Ubuntu)
目前我在自定义装备中在 Windows 8x64 上使用 RubyMine 5.4 IDE。我要使用三个 Ruby SDK:2.0x64PO、2.0PO 和 1.9.3,并安装了最新版本的 Rails。Rubygems 与最新版本的 SQLite3、mysql 和 Mysql2 一起安装,并通过手动安装正确安装。
下面是我在尝试运行时在 rubymine 中遇到的错误的副本。
runnerw.exe C:\Ruby200\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/RocYourSockx/RubymineProjects/testerrails/bin/rails server -b 127.0.0.1 -p 3000 -e development
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.0/mysql2 (LoadError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/config/application.rb:7:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/bin/rails:4:in `require'
from C:/Users/RocYourSockx/RubymineProjects/testerrailsnigga/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1