[ruby-on-rails] "Could not find bundler" error

When I try to do bundler update I get this error:

.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
`to_specs': Could not find bundler (>= 0) amongst
[rake-0.8.7, rake-0.8.7, rubygems-update-1.8.4] (Gem::LoadError)

I'm new to Ruby, can someone tell me what would cause this? Rake 0.8.7 is installed.

This question is related to ruby-on-rails ruby rake bundler

The answer is


I resolved it by deleting Gemfile.lock and gem install bundler:2.2.0


Can be related to https://github.com/bundler/bundler-features/issues/34 if you are running the command inside another bundle exec. Try using Bundler.with_original_env if that is the case.


If You are using rvm, then try the following command:

rvmsudo gem install bundler

According to another question: Could not find rails (>= 0) amongst [] (Gem::LoadError)

Hope it helped, Cheers


I had the same problem. This worked for me:

  1. run rvm/script/rvm and also add it to your .profile or .bash_profile as shown in https://rvm.io/rvm/install/

  2. use bundle without sudo


According to this answer to a similar question, it should be enough:

rvmsudo gem install bundler.

Cheers


The system might be running "rootless". Try to set the firmware nvram variable boot-args to "rootless=0". Try to run set of commands:

sudo nvram boot-args="rootless=0"; 
sudo reboot

After reboot completes, run:

sudo gem install bundler

If you're using rbenv running rbenv rehash can solve this after you've installed bundler and are still getting the issue.


Just in case, I had similar error with bundler 2.1.2 and solved it with:

sudo gem install bundler -v 1.17.3

If you have several bundler versions installed, then you can run specific version of bundle this way: bundle _1.17.3_ exec rspec

Though seems like later bundler versions are pretty buggy (had issues on 3 different projects on 2 operation systems), having one old bundler may work the best, at least this is what I have on my Ubuntu & MacOS

Latest bundler versions may override stable bundler -v 1.17.3. It can be not easy to remove latest bundler from system, here is what helped me:


In my case I believe I had an old Ruby remaining on the system, not registered on rvm, and even if the path variables and gem list was okay, it would still use the old Ruby during deployments with Capistrano

And then I realized, the Ruby I had installed with rvm wasn't set to the default one. Running

rvm alias create default <rvm_registered_ruby>

Fixed it.


The command is bundle update (there is no "r" in the "bundle").

To check if bundler is installed do : gem list bundler or even which bundle and the command will list either the bundler version or the path to it. If nothing is shown, then install bundler by typing gem install bundler.


You may have to do something like "rvm use 1.9.2" first so that you are using the correct ruby and gemset. You can check which ruby you are using by doing "which ruby"


I got this after upgrading to ruby 2.1.0. My PATH was set in my login script to include .gem/ruby/2.0.0/bin. Updating the version number fixed it.


I had the same problem .. something happened to my bash profile that wasn't setting up the RVM stuff correctly.

Make sure your bash profile has the following line:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Then I ran "source ~/.bash_profile" and that reloaded everything that was in my bash profile.

That seemed to fix it for me.


I had this problem, then I did:

gem install bundle

notice "bundle" not "bundler" solved my problem.

then in your project folder do:

bundle install

and then you can run your project using:

script/rails server

For anyone encountering this issue with Capistrano: capistrano isn't able to locate the bundler. The reason might be that you installed bundler under some other gemset where the Capistrano isn't even looking.

  1. List your gemsets.

rvm gemset list

  1. Use a particular gemset.

rvm use 'my_get_set'

  1. Install bundler under that gemset.

gem install bundler

Then, try again with the deploy task.


Examples related to ruby-on-rails

Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Where do I put a single filter that filters methods in two controllers in Rails Empty brackets '[]' appearing when using .where How to integrate Dart into a Rails app Rails 2.3.4 Persisting Model on Validation Failure How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? Rails: Can't verify CSRF token authenticity when making a POST request Uncaught ReferenceError: React is not defined

Examples related to ruby

Uninitialized Constant MessagesController Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Ruby - ignore "exit" in code Empty brackets '[]' appearing when using .where find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite? How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? How to update Ruby with Homebrew?

Examples related to rake

Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources Difference between rake db:migrate db:reset and db:schema:load Rails and PostgreSQL: Role postgres does not exist What does bundle exec rake mean? "Could not find bundler" error Rails how to run rake task How to rollback just one step using rake db:migrate Purge or recreate a Ruby on Rails database Rails DB Migration - How To Drop a Table? how to do "press enter to exit" in batch

Examples related to bundler

You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) Why won't bundler install JSON gem? Update just one gem with bundler bundle install fails with SSL certificate verification error rails bundle clean Understanding the Gemfile.lock file What does bundle exec rake mean? "Could not find bundler" error How do I specify local .gem files in my Gemfile? What is the best way to uninstall gems from a rails3 project?