0

I kinda messed up when trying to solve a problem.

I was looking up some solutions to solve this problem

 cap staging deploy
rbenv: cap: command not found

The `cap' command exists in these Ruby versions:
  3.0.0

One solution I came across has something to do with gem install bundler

To check my gem bundler, I ran gem list bundler which listed nothing so I ran gem install bundler which installed bundler (2.2.23).

However, when I ran bundle install, I get this:

Traceback (most recent call last):
    2: from /Users/kiki/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
    1: from /Users/kiki/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/kiki/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

So I wanted to uninstall/undo the steps I took. However, typing in gem uninstall bundler and gem uninstall bundler -v 2.2.23 didn't work! It kept returning Gem 'bundler' is not installed and in fresh terminal, when I ran the command again, it returns Gem bundler-2.2.23 cannot be uninstalled because it is a default gem.

How do I fix it?

Kristina Bressler
  • 1,642
  • 1
  • 25
  • 60
  • Try to call [rbenv rehash](https://github.com/rbenv/rbenv#rbenv-rehash). What return `where bundler` and `rbenv which bundler`? May be try to call `bundler` with full path. – zswqa Jul 14 '21 at 19:55
  • That's what I get when I typed in `where bundler` : /Users/kiki/.rbenv/shims/bundler /Users/kiki/.rbenv/shims/bundler /usr/bin/bundler – Kristina Bressler Jul 14 '21 at 19:58
  • and `rbenv which bundler` returns `/Users/kiki/.rbenv/versions/2.5.1/bin/bundler` – Kristina Bressler Jul 14 '21 at 19:59
  • Do I go to the folder and delete this file? – Kristina Bressler Jul 14 '21 at 20:00
  • No, just try to call bundler with full path`/Users/kiki/.rbenv/shims/bundler install`. And you have typo - not `bundle install` but `bundler install`. – zswqa Jul 14 '21 at 20:09
  • I don't want to use bundler. I wanted to use bundle instead. So I wanted to delete gem bundler and clear the default gem – Kristina Bressler Jul 14 '21 at 20:14
  • What does `bundler install` do? Will it overwrite the gem bundler default version? – Kristina Bressler Jul 14 '21 at 20:22
  • No, it will not overwrite. `bundler install` install gems that are listed in Gemfile. Your error "can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)" is [bundler bug](https://bundler.io/blog/2019/05/14/solutions-for-cant-find-gem-bundler-with-executable-bundle.html) – zswqa Jul 14 '21 at 20:31
  • 1
    Never mind. I got it working by following the instructions inhttps://stackoverflow.com/questions/57306611/rails-how-can-i-remove-default-version-of-bundler – Kristina Bressler Jul 14 '21 at 20:35

0 Answers0