Capistrano抛出:请安装mysql2适配器

时间:2012-11-12 11:41:36

标签: ruby-on-rails capistrano

我使用Capistrano部署使用mysql2适配器的Rails 3.2.1应用程序。

该应用程序在Windows上本地运行正常,但当我尝试部署到Linux服务器时,Capistrano引发以下错误:

Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.)

请注意我在GIT上跟踪Gemfile.lock,但我注意到了这一点:

...
mysql2 (0.3.11-x86-mingw32)
...

锁文件锁定了版本,这很好,但我认为它锁定了Windows版本(x86-mingw32),这可能无法在linux上运行。

有人有同样的问题吗?我不想忘记Gemfile.lock,因为不建议这样做。

我的deploy.rb就像:

require "bundler/capistrano"
load "deploy/assets"

... configuration here ...

P.S。我还注意到其他宝石用这个部分锁定了“x86-mingw32”,比如bcrypt-ruby

1 个答案:

答案 0 :(得分:0)

不要担心Gemfile.lock中带有“mingw32”的任何宝石。看看你的Gemfile。你有以下几行吗?

gem 'mysql2'

鉴于此,您是否在linux服务器上运行bundle install(或者您是否将此功能添加到了capistrano配方中?)

顺便说一句,如果您有任何特定于Windows的宝石,并且您想确保它们仅在此上下文中加载,请使用以下条件:

platforms :mswin, :mingw do
  # placeholder for gems in a windows environment
end