使用rails服务器时出现此错误
C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:6:in `require': cannot load such file -- mysql/mysql_api (LoadError)
from C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:6:in `rescue in <top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
from E:/ruby/config/application.rb:7:in `<top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from C:/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from E:/ruby/bin/rails:4:in `require'
from E:/ruby/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
我通过下载mysql-controller-c安装了mysql,但它仍然报告我一个错误,并且我将libmysql.dll复制到ruby / bin,我也将它复制到system32,它仍然有问题,可以有人给我一个解决它的建议。
答案 0 :(得分:0)
此gem没有针对Ruby-2.0的预构建本机扩展(请参阅C:\Ruby\lib\ruby\gems\2.0.0\gems\mysql-2.9.1-x86-mingw32\lib\mysql
)。您必须build it yourself或降级为ruby-1.9。