LoginSignup
13
11

More than 5 years have passed since last update.

プラットフォーム依存のgemのせいでデプロイがこける件

Last updated at Posted at 2014-02-05
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

You have deleted from the Gemfile:
* growl

みたいなメッセージがでてきてデプロイ大失敗した。

原因はGemfileにRUBY_PLATFORMを使ったことだった。

Gemfile
group :test do
  gem "growl" if RUBY_PLATFORM =~ /darwin/
end

上のメッセージはGemfileとGemfile.lockに不整合があるときに表示される。このようなGemfileの書き方だと、デプロイ先で実行したとき、gem "growl"が存在しないことになりGemfile.lockとの不整合が生まれると考えられる。

そこで、Gemfileをこう書き替えた。

Gemfile
group :test do
  gem "growl", group: :darwin
end

で、capistranoにこのグループをインストールしないように設定する。

deploy.rb
# Ignore platform-specific gems
set :bundle_without, %w(development test darwin).join(" ")
13
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
11