簡體   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