I am deploying a rails app to EC2 with using Capistrano, but within the deployment process, I got
...
ERROR: Gem bundler is not installed, run `gem install bundler` first.
command finished in 344ms
*** [deploy:update_code] rolling back
...
I am not sure what's the problem, here's the list of installed gems on EC2:
bundler (1.3.5)
rake (10.0.4)
rubygems-bundler (1.1.1)
rvm (1.11.3.7)
ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
Can anyone give me a tip how to fix it?
Thanks
Can you give some details:
Are you using rvm ?
What is the rails version in your Gemfile ?
Gem version ?
If you are using rvm, check for the gemset being used, remove .bundle and do a fresh $ bundle to install the gems.
Post the entire o/p from command $ gem list from your project folder.
Related
$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 1.17.3)
capistrano-bundler (2.0.1)
$ ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
$ bundle _1.17.3_ -v
Bundler version 2.1.4
Why does Bundler claim to be 2.1.4, when I don't have that installed?
Is this a way of trying to force me to upgrade by making my Gemfile think I used a newer version, and then making me install that to continue?
Or is there some configuration that I'm overlooking?
UPDATE
gem list bundle -d returns
*** LOCAL GEMS ***
bundler (1.17.3)
Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
Terence Lee, Carl Lerche, Yehuda Katz
Homepage: http://bundler.io
License: MIT
Installed at (default): /Users/brandon/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
The best way to manage your application's dependencies
capistrano-bundler (2.0.1)
Authors: Tom Clements, Lee Hambley, Kir Shatrov
Homepage: https://github.com/capistrano/bundler
License: MIT
Installed at: /Users/brandon/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
Bundler support for Capistrano 3.x
which bundle returns
/Users/brandon/.rbenv/shims/bundle
Running eval "$(rbenv init -)" does not change anything.
Updating above 2.1.4 doesn't fix the problem either. No matter what I install, I'm told I'm using 2.1.4:
$ gem install --default bundler:2.2.24
Successfully installed bundler-2.2.24 as a default gem
WARNING: Unable to pull data from 'https://gems.github.com/': bad response Not Found 404 (https://gems.github.com/specs.4.8.gz)
1 gem installed
$ bundler --version
Bundler version 2.1.4
You probably have couple versions installed,
try
gem list bundle -d
to see where those are installed
which bundle
to see where 2.1.4 resides
If you are working in a shared environment,
may be the root user would have the bundler which is showing bundle -v as 2.1.4
to find it, you can try digging it in your environment
by env command which will give your environment variables list:
$ env
$ echo $PATH
and your bundler list which you are seeing on gem list bundler would be from your local user space
you can refer these too, which would probably hit the solution
How to `bundle install` when your Gemfile requires an older version of bundler?
How to bundle install gemfile with specific version of bundler
I'm having trouble creating a new Rails app. I'm using a fresh WSL2 + Ubuntu 18.04 install.
Long story short, I followed the Rails installation procedure from https://gorails.com/setup/windows/10 but when installing bundle using gem install bundler, I end up with 2 bundler versions (2.1.2 and 2.1.4).
If I stick with 2.1.2 webpacker throws an error, so I definitely need to install the newest version. The problem is, when I install 2.1.4 the default version remains 2.1.2, so then I go to cd /.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/specifications/default and remove bundler-2.1.2.gemspec, and then I do a gem install bundler --default to get only v2.1.4 as default:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4)
But here is the problem; if I run bundler -v I get:
bundler -v
Bundler version 2.1.2
But the real problem is that, when running rails new, it clearly tries to use 2.1.2 which inevitably fails.
How can I solve this?
Thank you
Try gem uninstall bundler --version 2.1.2.
From the app directory run these commands:
gem install bundler
bundle update --bundler
bundle install
This rebuilds the Gemfile.lock with the correct Bundler version.
EDIT: You can create the directory first with rails new my_rails_app, then do cd .. ; rails new my_rails_app after running the above commands.
I've been following the railscast on setting up Vagrant with rails found here:
http://railscasts.com/episodes/292-virtual-machines-with-vagrant
I have rbenv running on vagrant with a slightly more updated version of ruby(1.9.3p125). Everything goes fine until I try to bundle. Here's the error I get:
vagrant#lucid32:/vagrant$ bundle
Fetching gem metadata from http:rubygems...
Fetching gem metadata from http:rubygems...
Resolving dependencies...
Using rake (10.0.3)
Errno::EPROTO: Protocol error - /vagrant/bin
An error occurred while installing rake (10.0.3), and Bundler cannot continue.
Make sure that gem install rake -v '10.0.3' succeeds before bundling.
I've tried gem installing that version of rake, then running rbenv rehash which seems to install, but running bundle again still gives me the same error.
I was able to resolve this by downgrading bundler from 1.3.2 to 1.2.5.
rvm use #global
gem uninstall bundler
gem install bundler -v 1.2.5
# switch back to the default gemset
rvm use
bundle install
# everything should work now
The only other thing that I changed was I reverted from rvm 1.18.19 to 1.17.10, but I am not positive that step is necessary.
I'm having a dearly hard time getting my rails environment up. Here is the issue.
$ gem install rails --version 3.0.1
Successfully installed rails-3.0.1
1 gem installed
Installing ri documentation for rails-3.0.1...
Installing RDoc documentation for rails-3.0.1...
$ rails -v
/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': **Unable to activate rails-3.0.1, because bundler-1.1.5 conflicts with bundler (~> 1.0.0) (Gem::LoadError)**
from /.rvm/rubies/ruby-1.9.2- p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:1232:in `gem'
from /.rvm/gems/ruby-1.9.2-p320#rails3tutorial/bin/rails:18:in `<main>'
from /.rvm/gems/ruby-1.9.2-p320#rails3tutorial/bin/ruby_noexec_wrapper:14:in `eval'
from /.rvm/gems/ruby-1.9.2-p320#rails3tutorial/bin/ruby_noexec_wrapper:14:in `<main>'
Here in lies the issue. I've reinstalled ruby. I've installed 1.8.7, 1.9.2, 1.9.3 and still no luck across the board.
i've run
$ gem update bundler
But bundle is 'up to date', so still no luck
I've really poked at this all day now, and with no luck I open my palms to you all.
the issue is that in #global gemset you have higher version of bundler then the one required.
you can either specify the version on command line:
bundle _1.0.27_ exec rails -v
or use Gemfile:
printf 'source :rubygems\ngem "rails", "3.0.1"\n'
rails -v
this assumed you have the gem rubygems-bundler - but it comes by default with RVM so you should have it.
and last - remove bundler from #global:
rvm #global do gem uninstall bundler
but there is one caveat - while reinstalling ruby gem bundler will be installed again.
Somehow my rails installation hides itself successfully...
I have:
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm 1.10.0-pre
gem 1.8.10
and I try to install rails:
sudo gem install rails
it works fine:
Successfully installed rails-3.1.3
1 gem installed
Installing ri documentation for rails-3.1.3...
Installing RDoc documentation for rails-3.1.3...
when I do:
rails - v
I get
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Also, when I do
rake
in a rails app root directory, I get:
Missing the Rails gem. Please `gem install -v= rails`, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version
you do have installed, or comment out RAILS_GEM_VERSION to use the
latest version installed.
executing
gem install -v= rails
raises an error:
ERROR: While executing gem ... (ArgumentError)
Illformed requirement ["="]
So apparently it is sitting somewhere and cannot be seen by my environment. I guess installing via apt-get is not an option as I don't want to confuse gem...
Any ideas?
Cheers
Mac
Do not use sudo.
Just gem install rails
Use RVM instead of the packaged ruby/gems distribution. http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/