无法启动rails服务器。找不到指定的模块

时间:2014-02-08 09:23:36

标签: sql ruby-on-rails ruby

编程,ruby,rails,sql等新手。跟随视频教程,但遇到了这个错误。任何帮助表示赞赏。

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>

1 个答案:

答案 0 :(得分:0)

我们需要从头开始:

  1. 使用http://rubyinstaller.org/downloads/
  2. 中的Windows安装程序安装Ruby
  3. 安装捆绑包: gem install bundler
  4. 对于Windows上的mysql,我认为你需要devkit。从http://rubyinstaller.org/downloads/
  5. 获取与您的操作系统匹配的那个
  6. 确保您的PC上安装了mysql。
  7. 确保mysql2 gem正确安装。如果gem install mysql2未正确安装,您可能需要以下内容:gem install mysql2 -- --with-mysql-dir="C:\mysql\bin";将c:\mysql\bin更改为您在步骤4中安装mysql的位置
  8. 安装rails:gem install rails
  9. 转到您的目录c:\ sites \ simple_cms并输入:bundle install
  10. 现在尝试启动您的服务器:rails s
  11. Windows上的Rails开发已经取得了很大的进步但是如果你真的想要保持最新并避免将来出现一些奇怪的问题(特别是在支持gem的情况下),我建议你使用Ubuntu作为例子。如果您没有其他计算机或者不希望进行双重启动,则可以免费安装VirtualBoxhttps://www.virtualbox.org/wiki/Downloads)并在其上运行Ubuntu。