无法启动WEBrick服务器。 Mysql2`requireth':无法加载这样的文件

时间:2015-04-16 15:36:28

标签: ruby-on-rails ruby webrick

我在干净的Windows 8安装上安装了全新的Ruby / Rails,并且在尝试启动WEBrick服务器时遇到错误。找了答案,但找不到答案。

错误如下:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
        from C:/Users/Brendon/Sites/quote/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

任何帮助非常感谢

1 个答案:

答案 0 :(得分:0)

您需要先使用bundler来安装gem。

要么:

gem install mysql2

cd /my/rails/project && bundle install

注意:mysql2 gem是一个[expletive]来安装...祝你好运