capistrano deploy issue: "rails (= 4.0.0) depends on bundler (< 2.0, >= 1.3.0)"

Hi all,

I am trying to push rails 4 app into my server using capistrano.

i am getting following error while ‘cap deploy’,

  • executing “cd – projects/testproject/releases/20140121061131 && RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile”

servers: [“xxxxxxx”]

[xxxxxxx] executing command

*** [err :: xxxxxxx] rake aborted!

*** [err :: xxxxxxx]

*** [err :: xxxxxxx] Bundler could not find compatible versions for gem “bundler”:

*** [err :: xxxxxxx] In Gemfile:

*** [err :: xxxxxxx] rails (= 4.0.0) depends on

*** [err :: xxxxxxx] bundler (< 2.0, >= 1.3.0)

*** [err :: xxxxxxx]

*** [err :: xxxxxxx] Current Bundler version:

*** [err :: xxxxxxx] bundler (1.0.15)

*** [err :: xxxxxxx]

*** [err :: xxxxxxx] (See full trace by running task with --trace)

*** [err :: xxxxxxx]

command finished in 541ms

*** [deploy:update_code] rolling back

but in both local and server i have bundler version 1.5.0

Can anyone help me?

My deploy.rb file:

require ‘capistrano/ext/multistage’

#require ‘bundler/capistrano’

set :stages, [“development”, “production”]

set :default_stage, “development”

set :application, “testproject”

set :scm, “git”

set :repository, “path_to_my_project_repo_xxxxxx”

set(:deploy_to) { “/home/xxxx/projects/#{application}” }

set :user, “username”

set :password, “password”

set :deploy_via, :copy

set :branch, “master”

set :keep_releases, 5

set :use_sudo, false

Or: accurev, bzr, cvs, darcs, git, mercurial, perforce, subversion or none

role :web, “xxxxxxxxx” # Your HTTP server, Apache/etc

role :app, “xxxxxxxxx” # This may be the same as your Web server

role :db, “xxxxxxxxx”, :primary => true # This is where Rails migrations will run

after “deploy”, “deploy:symlink_config_files”

namespace :deploy do

desc “Symlink shared config files”

task :symlink_config_files, :roles => [:app] do

run “ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml”

run “if [ -d #{release_path}/tmp ]; then rm -rf #{release_path}/tmp; fi; ln -nfs #{deploy_to}/#{shared_dir}/tmp #{release_path}/tmp”

end

end

My Gemfile:

source ‘https://rubygems.org

gem ‘rails’, ‘4.0.0’

gem ‘mysql2’

gem ‘magic_multi_connections’

gem ‘execjs’

gem ‘therubyracer’, :platforms => :ruby

gem ‘sass-rails’, ‘~> 4.0.0’

gem ‘uglifier’, ‘>= 1.3.0’

#gem ‘capistrano’, ‘~> 2.15’

group :development do

gem ‘capistrano’, ‘~> 2.15’

end

gem ‘coffee-rails’, ‘~> 4.0.0’

gem ‘jquery-rails’

gem ‘turbolinks’

gem ‘jbuilder’, ‘~> 1.2’

group :doc do

gem ‘sdoc’#, require: false

end

gem ‘bcrypt-ruby’, ‘~> 3.0.0’

Regards

Saravanan P

Some where on the server there is /not/ bundler 1.5.0 because it's
showing that it has access to bundler 1.0.15. I would first try to
login to the server and gem update (since most of the time bundler is
the only gem aside from the set of default gems that is setup in gem)
and then gem clean and try a fresh deploy.

Now i am getting following error,
Even i have installed ruby 2.0.0 in my server its showing like require >= 1.9.3

in my server:

$ ruby -v

ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]

*** [err :: xxx.xxx.xxx.xx] /usr/lib/ruby/vendor_ruby/1.8/rubygems/installer.rb:388:in `ensure_required_ruby_version_met’

*** [err :: xxx.xxx.xxx.xx] :

*** [err :: xxx.xxx.xxx.xx] activesupport requires Ruby version >= 1.9.3.

*** [err :: xxx.xxx.xxx.xx] (

*** [err :: xxx.xxx.xxx.xx] Gem::InstallError

*** [err :: xxx.xxx.xxx.xx] )

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/1.8/rubygems/installer.rb:156:in `install’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/source.rb:101:in `install’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:78:in `preserve_paths’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/source.rb:91:in `install’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/installer.rb:58:in `run’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:93:in `with_build_args’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/installer.rb:57:in `run’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:12:in `each’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:12:in `each’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/installer.rb:49:in `run’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/installer.rb:8:in `install’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:222:in `install’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `send’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `run’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/invocation.rb:118:in `invoke_task’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:246:in `dispatch’

*** [err :: xxx.xxx.xxx.xx] from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:389:in `start’

*** [err :: xxx.xxx.xxx.xx] from /usr/bin/bundle:13

command finished in 213763ms

*** [deploy:update_code] rolling back

In my server terminal,

$ ruby -v

ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]

and

$ sudo ruby -v

ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

How can change ruby latest version?

My server running in Ubuntu 12.04

Regards,

Saravanan P

What is the return of the command `which ruby` as the user that has 2.0.0?

Hi Jordon,

$ which ruby

/home/username/.rvm/rubies/ruby-2.0.0-p353/bin/ruby

$ sudo which ruby

/usr/bin/ruby

I solved the issue by uninstalling old ruby version

sudo apt-get remove ruby1.8

and installed

sudo apt-get install ruby1.9.3

Thanks for your support!