简体   繁体   中英

Issue with Mysql2, RoR, and Windows 8 x64

Okay so I've been having a heck of a time getting my IDE environment setup for Ruby and RoR. Every issue so far I've been able to solve except one so I humbly ask the mighty stackoverflow for guidance.

MY RubyMine install is having trouble recognizing some installed gems or more specifically, SQLite3, Mysql, and Mysql2. Using Gem quick install on RubyMine fails on all three, however, installing the gems with the proper config is successful in cmd. While that is successful, RubyMine cannot or will not recognize the installed gems. The 'require mysql2' (with 'require rubygems' placed before it) fails right out of the gate with RubyMine stating that it cannot load such a file. When accessing the RoR server on localhost through firefox, I get an error stating that the gem is not loaded and I should add it to my Gemfile ( I should state at this point that all the above gems were already in the gemfile and if not I added them and ran bundle install) which is confusing. I've spent days scouring the interwebs and stackoverflow for a solution but nothing seems to work. I even tried going from the 64 version of ruby 2 to the 32 bit version and some previous versions.

on a side note, would it be easier to code ruby in a linux distro? (like Ubuntu)

Currently I am using RubyMine 5.4 IDE on Windows 8x64 within a custom rig. I have three Ruby SDK's to use: 2.0x64PO, 2.0PO, and 1.9.3 and have the most current version of Rails installed. Rubygems is installed along with the most recent versions of SQLite3, mysql, and Mysql2 installed correctly with manual install.

below is a copy of the error I get within rubymine when trying to run.

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

To answer your side note, ruby + windows is a painful, painful process imo. You would likely be better off installing VirtualBox and a modern Ubuntu virtual machine. It can be troublesome to get gems working under windows.

I use OSX at work, and am currently setting up an Ubuntu image from here : http://virtualboxes.org/images/ubuntu/ on my home laptop simply because I am sick and tired of trying to be productive on windows 7.

Download a connector from here: http://dev.mysql.com/downloads/connector/c/6.0.html#downloads ZIP Archive and not installer, from its lib folder copy the libmysql.dll file and paste it into the Ruby200/bin directory. I think that should fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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