2013-05-08 53 views
0

好吧,所以我一直有一段时间让我的IDE环境安装Ruby和RoR。到目前为止,我已经能够解决的每一个问题,除了一个问题,所以我虚心地问强大的计算器来寻求指导。问题与Mysql2,RoR和Windows 8 x64

我的RubyMine安装在识别一些已安装的gem或更具体的SQLite3,Mysql和Mysql2时遇到了问题。在RubyMine上使用Gem快速安装失败,但是,在cmd中使用正确的配置安装gem已成功。虽然这是成功的,但RubyMine不能或不会识别已安装的gem。 '需要mysql2'(其中'需要rubygems'放在它之前)用RubyMine说明它无法加载这样的文件。当通过firefox访问本地主机上的RoR服务器时,我收到一个错误信息,说明该gem没有被加载,我应该将它添加到我的Gemfile中(我应该说明所有上述gem已经在gemfile中,如果没有,添加它们并运行捆绑安装),这是令人困惑的。我已经花了几天时间搜寻interwebs和stackoverflow以获得解决方案,但似乎没有任何工作。我甚至尝试从64位版本的红宝石2到32位版本和一些以前的版本。

在旁边注释,它会更容易在linux发行版中编写ruby代码吗? (如Ubuntu)

目前我在自定义钻机中使用Windows 8x64上的RubyMine 5.4 IDE。我有三个Ruby SDK可以使用:2.0x64PO,2.0PO和1.9.3,并且安装了最新版本的Rails。 Rubygems与最新版本的SQLite3,mysql和Mysql2一起安装,并且通过手动安装正确安装。

下面是我尝试运行时得到的错误的副本。

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 
+1

也许这个问题可以帮助你:http://stackoverflow.com/questions/15604058/error-cannot-load-such-file-mysql2-2-0-mysql2-loaderror-on-windows-xp – Mindbreaker 2013-05-08 12:53:11

+1

这是不是一个真正的答案,所以我会使用评论。很久以前,我放弃了在窗户上做铁轨。相反,我用ubuntu和samba共享启动一个VM(VMWare播放器)。我的项目文件在共享文件夹中,我可以在窗口上使用崇高的文本编辑它们,同时访问我的虚拟机中的终端。 我放弃了wondows,只是因为遇到了比posix操作系统更多的问题,并且在线上几乎没有任何帮助。 – Syl 2013-05-08 13:06:11

+0

在Linux上会更容易吗?是。它会更有效率吗?不必要。设置你的环境会更快,但一旦完成,它大致相同。 (至少,根据我对Windows 7和Ubuntu的经验)。如果您有选择在Linux中执行此操作,请执行此操作! RubyMine可用于Linux。如果你没有选择,不要吓坏了。 Windows安装程序是可能的。这只是血腥的困难。 – 2013-05-08 13:25:36

回答

1

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

我使用OSX的工作,和我目前设立在这里的Ubuntu的镜像:http://virtualboxes.org/images/ubuntu/在我的家用笔记本,只是因为我厌倦了试图在Windows 7的生产

+1

虽然在Windows上设置可能会很痛苦(一种残忍,残忍,令人虚弱的痛苦),但一旦完成,它就会非常顺利地航行。我专门在Windows 7上编写代码,发现自己非常有成效。 - 不要误解我的意思,但是,如果我能负担得起,我肯定会在Mac上编码。 - – 2013-05-08 13:22:16

+0

感谢大家的帮助。读完大家的回复之后,我想我会咬紧牙关,安装linux的虚拟机。我可以记得当我在Windows 7x64中使用Python时发生的相同类型的事情,所以我去了Ubuntu,这对于使用Python编写代码非常有用。看起来好像是一个很好的选择,对Ruby编码也是一个很好的选择。 – 2013-05-09 00:05:34