繁体   English   中英

Mysql2,RoR和Windows 8 x64的问题

[英]Issue with Mysql2, RoR, and Windows 8 x64

好的,我花了很长时间来为Ruby和RoR设置我的IDE环境。 到目前为止,我已经能够解决所有问题,因此我谦虚地向强大的stackoverflow寻求指导。

我的RubyMine安装无法识别某些已安装的gem,或更具体地说,SQLite3,Mysql和Mysql2。 在RubyMine上使用Gem快速安装在所有这三个方法上均失败,但是,在cmd中成功安装具有正确配置的gems即可。 成功完成后,RubyMine无法或不会识别已安装的gem。 “ require mysql2”(在其前面放置了“ require ruby​​gems”)失败,RubyMine指出无法加载此类文件。 通过firefox访问localhost上的RoR服务器时,出现错误,指出未加载gem,我应将其添加到我的Gemfile中(此时,我应该声明上述所有gems已经在gemfile中,如果没有,添加了它们并运行了bundle install),这很令人困惑。 我花了几天的时间寻找互连网和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

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM