Deploy failed when add new gem to Gemfile

I learnt how to deploy rails project to VPS from railscasts *#335
Deploying
to a VPS. *But I get a problem when add a new gem to Gemfile.

For this time, i add devise to Gemfile. and after git push I run
commend
cap deploy. Then it show message like this:

** [out :: ali] Gem::Installer::ExtensionBuildError: ERROR: Failed to
build gem native extension.
** [out :: ali]
** [out :: ali]
** [out :: ali] /usr/bin/ruby1.9.1 extconf.rb
** [out :: ali]
** [out :: ali]
** [out :: ali] Gem files will remain installed in
/home/deployer/apps/get-real/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1
for inspection.
** [out :: ali]
** [out :: ali] Results logged to
/home/deployer/apps/get-real/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
** [out :: ali]
** [out :: ali] An error occurred while installing bcrypt-ruby (3.0.1),
and Bundler cannot continue.
** [out :: ali]
** [out :: ali] Make sure that gem install bcrypt-ruby -v '3.0.1'
succeeds before bundling.

I have spent a lot of time on this but i can not solve it.

On Thursday, February 21, 2013 2:52:32 PM UTC, aisensiy wrote:

I learnt how to deploy rails project to VPS from railscasts *#335
Deploying to a VPS. *But I get a problem when add a new gem to Gemfile.

For this time, i add devise to Gemfile. and after git push I run commend
cap deploy. Then it show message like this:

As the message suggests it’s having trouble building the native
extension
for bcrypt-ruby. You’ll get a better error message by looking
at
/home/deployer/apps/get-real/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
but the underlying is probably 1 (or more) of the following:

  • you don’t have a compiler/toolchain installed (gcc and so on)
  • you don’t have the headers for ruby itself installed (sometimes
    package
    managers install this separately as ruby-devel or similar)
  • you don’t have a library (or the headers for that library) that
    bcrypt-ruby depends on (I don’t know if there are any)

The output from the build attempt should clarify which of these apply

Fred