2014-02-08 161 views
1

编程,ruby,rails,sql等新手。随着视频教程,但遇到此错误。任何帮助赞赏。无法启动rails服务器。无法找到特定模块

C:\sites\simple_cms>rails s 
c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `requir 
e': 126: The specified module could not be found. - c:/ruby200-x64/lib/ruby/ge 
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so (LoadError) 

     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb 
:8:in `<top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:76:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:76:in `block (2 levels) in require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:72:in `each' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:72:in `block in require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:61:in `each' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:61:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler.rb:132:in `require' 
     from C:/sites/simple_cms/config/application.rb:7:in `<top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:74:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:74:in `block in <top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:71:in `tap' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:71:in `<top (required)>' 
     from bin/rails:4:in `require' 
     from bin/rails:4:in `<main>' 

C:\sites\simple_cms> 
+0

首先在'c:\ sites \ simple_cms'中尝试'bundle install',然后重试。让我知道这是否工作 – Abdo

+0

谢谢。试过,但现在得到这个错误:c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:在'requir e':193: %1不是有效的Win32应用程序。 - c:/ ruby​​200-x64/lib/ruby​​/gems/2 .0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so(LoadError) from c:/ ruby​​200- x64/lib/ruby​​/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb :8:在' from c:/ ruby​​200-x64/lib/ruby /gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun dler/runtime.rb:76:在'require'..... – Jarg

+0

mysql2 gem需要一些TLC工作窗户(至少,当我尝试时是一种痛苦)。显然[这个人](http://stackoverflow.com/a/19023107/877472)设法解决它。也许它也可以帮助你。 –

回答

0

我们需要从头这里开始:

  1. 使用Windows安装程序从http://rubyinstaller.org/downloads/
  2. 安装Ruby安装捆绑: gem install bundler
  3. 对于Windows的MySQL,我认为你需要的的devkit。从http://rubyinstaller.org/downloads/
  4. 获取与您的操作系统相匹配的电源请确保您的电脑上安装了mysql。
  5. 确保mysql2 gem安装正确。如果gem install mysql2未正确安装,则可能需要如下内容:gem install mysql2 -- --with-mysql-dir="C:\mysql\bin";改变c:\mysql\bin的位置,可以在步骤安装mysql 4
  6. 安装导轨:gem install rails
  7. 转到目录C:\网站\ simple_cms和类型:bundle install
  8. 现在试图启动您的服务器:rails s

Windows上的Rails开发有了很大的改进,但如果你真的想保持最新并避免将来出现一些奇怪的问题(尤其是在支持gem的时候),我建议你使用Ubuntu。如果你没有另一台电脑或者不想进行双启动,你可以免费安装VirtualBoxhttps://www.virtualbox.org/wiki/Downloads),并运行Ubuntu。

+0

感谢您的帮助。关于从头开始。我需要先卸载所有内容吗?其次,我怎么知道我需要什么版本ie。 32位或64位?我知道即时通讯运行64位操作系统,但我很确定我的CPU是64位启用的,但是当我查看系统属性时,它只表示64位操作系统,并没有提到我的CPU。这是否表明它没有运行64位,这可能与错误有关吗?我想我正在运行所有ruby和sql软件的64位版本。运行32位的所有内容会更容易吗? – Jarg

+0

如果您正在运行64位操作系统,那么您最好使用64位安装。我不认为你需要卸载任何东西。安装人员应该注意这一点。如果你还有问题,欢迎循环返回=) – Abdo

+0

谢谢,我只是安装了虚拟盒子并运行了ubuntu。我现在如何在Ubuntu上执行此操作?我不知道从哪里开始真的大声笑。就像我必须下载所有内容一样,我如何访问命令提示符。和Ubuntu上的命令是不同的没有? – Jarg