Mysql2,RoR和Windows 8 x64的问题

时间:2013-05-08 12:47:01

标签: mysql ruby-on-rails ruby rubymine mysql2

好的,所以我一直在为Ruby和RoR设置IDE环境。到目前为止,每个问题我都能解决,除了一个,所以我谦虚地请求强大的stackoverflow作为指导。

我的RubyMine安装无法识别一些已安装的gem,或者更具体地说,SQLite3,Mysql和Mysql2。在RubyMine上使用Gem快速安装在所有三个上都失败了,但是,在cmd中安装具有正确配置的gem是成功的。虽然这很成功,但RubyMine无法或不会识别已安装的宝石。使用RubyMine的'require mysql2'(在其前面放置'require ruby​​gems')失败了,声明它无法加载这样的文件。当通过firefox访问localhost上的RoR服务器时,我收到一条错误,指出没有加载gem,我应该将它添加到我的Gemfile中(我应该说明所有上面的gem已经在gemfile中了,如果不是我的话添加它们并运行bundle install)这令人困惑。我花了几天时间搜索互联网和stackoverflow以获得解决方案,但似乎没有任何工作。我甚至试过从64版本的ruby 2到32位版本和一些以前的版本。

另外,在Linux发行版中编写ruby会更容易吗? (比如Ubuntu)

目前我在自定义装备中使用Windows 8x64上的RubyMine 5.4 IDE。我有三个Ruby SDK可供使用:2.0x64PO,2.0PO和1.9.3,并安装了最新版本的Rails。随着手动安装正确安装了最新版本的SQLite3,mysql和Mysql2,安装了Rubygems。

下面的

是我在试图运行时在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

2 个答案:

答案 0 :(得分:1)

回答你的旁注,ruby + windows是一个痛苦,痛苦的过程。安装VirtualBox和现代Ubuntu虚拟机可能会更好。让宝石在windows下工作会很麻烦。

我在工作中使用OSX,目前正在我的家用笔记本电脑上设置Ubuntu图像:http://virtualboxes.org/images/ubuntu/因为我厌倦了尝试在Windows 7上高效工作。

答案 1 :(得分:0)

从此处下载连接器: http://dev.mysql.com/downloads/connector/c/6.0.html#downloads ZIP存档而非安装程序,从其lib文件夹复制libmysql.dll文件并将其粘贴到Ruby200 / bin目录中。我认为应该解决它。