bash: bundle: command not found even though bundler is installed - ruby-on-rails

I am hosting a Rails app on AWS EC2 instance and am deploying my application with Capistrano. During deployment I have been able to solve errors by installing missing tools like Monit. However, I'm stumped by this error: puma stderr: bash: bundle: command not found. I see bundler is installed on the server, but when i type bundle the terminal says Could not locate Gemfile. I have even tried reinstalling bundler gem install bundler but bundle command is still not recognized. I have listed details about my deployment target below. I'm not sure what to do and would appreciate any help.
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.6.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- /home/ubuntu/.gem/ruby/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.6.5/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH returns
/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
which gem returns
/home/ubuntu/.rbenv/shims/gem
locate bundle returns
/home/ubuntu/.gem/specs/rubygems.org%443/quick/Marshal.4.8/bundler-1.17.1.gemspec
/home/ubuntu/.rbenv/shims/bundle
/home/ubuntu/.rbenv/shims/bundler
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundle
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/build_metadata.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/capistrano.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli.rb
...

Seems like some puma setting was overwritten. I added the following line to deploy.rb : set :rbenv_map_bins, %w{rake gem bundle ruby rails puma pumactl} to get past this error.
Link to the solution:
https://github.com/seuros/capistrano-puma/issues/206

If you use bundler, you should add capistrano-bundler. See GitHub issue

Related

Running Ruby with Homebrew but cannot get Bundler to Work

Running bundle install I get the error: "-bash: bundle: command not found"
I can install Bundler with gem install bundler and I get no errors. In fact, if I run gem list it shows bundler (1.14.6). However, bundle -v or anything like that doesn't work.
I have uninstalled bundler and re-installed.
gem env returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5.1
- RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.2.3/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/2.2.3/bin
- SPEC CACHE DIRECTORY: /Users/mike/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- /Users/mike/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/Cellar/ruby/2.2.3/bin/ruby
- /usr/local/bin/gem
brew doctor says "Your system is ready to brew"
echo $PATH says /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/ruby/2.2.3/bin/ruby:/usr/local/bin/gem
which gem returns: /usr/local/bin/gem
While this may not be a solution to your current issue, it is an alternative that could help you down the road in developing in Ruby / Rails.
I'd recommend moving to a ruby version control system such as RVM or rbenv where you then have full control over your ruby version on a per-project basis. It's much easier than playing with your system Ruby on OS X too. You'll probably find that once you have one of these installed, your bundler issues disappear.
Well, it's a little bit late answer, but I was able to do it like this:
gem install bundler -n /opt/homebrew/opt/ruby#2.5/bin
Where /opt/homebrew/opt/ruby#2.5/bin is a path where homebrew ruby installation gems is located

I can't run bundle it show bundle: command not found

I install bundle by using
sudo bundle install and sudo gem install bundler
It show error
bundle: command not found
I set path like this.
export PATH=$PATH:/var/lib/gems/1.8/bin
When I run command gem environment it show like this.
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
When I run command echo $PATH it show like this.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
How to fix error bundle: command not found ?
Simply hit the command
$gem install bundle
if the ruby version is required to updated do it separately
bundle(r) is a gem. I am guessing you have the gem not installed yet.
try
gem install bundler
Well, you're trying to install ruby as system package, and I would suggest not doing that since ruby 1.8 is very old version.
You should use rvm or rbenv instead for ruby installation.
Take a look on http://rvm.io. After rvm installed, install ruby
rvm install 2.3.1
then install bundler
gem install bundler

Bundle is installed, yet `-bash: bundle: command not found` when using any bundle command in app directory

I'm setting up a new Mac and trying to get dev environemnt set up. Using Homebrew & RVM as package managers. I have bundler installed when i run bundler -v from root it get Bundler version 1.13.6 no problem.
However I've just cloned one of my app projects locally and when in that app's directory bundler returns command not found. Surley I shouldn't need to install Bundler when in each directory?!? Is this some user permisisons issue? Can you help me understand this situation and why bundler doesn't work in the newly pulled app directory? Ultimately I'm just trying to bundle install the gemfile for this newly cloned application.
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/usr/.rvm/gems/ruby-2.2.2
- RUBY EXECUTABLE: /Users/usr/.rvm/rubies/ruby-2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/usr/rvm/gems/ruby-2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/usr/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/usr/.rvm/rubies/ruby-2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/usr/.rvm/gems/ruby-2.2.2
- /Users/usr/.rvm/gems/ruby-2.2.2#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/usr/.rvm/gems/ruby-2.2.2/bin
- /Users/usr/.rvm/gems/ruby-2.2.2#global/bin
- /Users/jusr/.rvm/rubies/ruby-2.2.2/bin
- /Users/usr/.rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
echo $PATH
/Users/usr/.rvm/gems/ruby-2.2.2/bin:/Users/usr/.rvm/gems/ruby-2.2.2#global/bin:/Users/usr/.rvm/rubies/ruby-2.2.2/bin:/Users/usr/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
which gem
/Users/usr/.rvm/rubies/ruby-2.2.2/bin/gem
You need to issue the following command:
rmv use 2.2.2

Dradis Framework error in Kali Linux. Error :bundler: command not found: rails

I tried installing Dradis framework on Kali Linux,my testing operating system.I have followed the instructions given hereGit Repo for Dradis and after executing
ruby bin/setup
it created separate folders for each framework and then when executing the next command
`bundle exec rails server`
the installation file broke and gave an error.
bundler: command not found: rails
Install missing gem executables with `bundle install`
Later i checked my rails environment and it gave me this..
> RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.1.0
- RUBY EXECUTABLE: /usr/bin/ruby2.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/test/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/2.1.0
- /home/test/.gem/ruby/2.1.0
- /usr/share/rubygems-integration/2.1.0
- /usr/share/rubygems-integration/2.1
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/local/games
- /usr/games
I even tried this link correspond to same errorError Link in Issues but the result was same.Is there any way i can completely remove rails from my Kali Linux and re install it again and update it.
Dradis committer here, first thing that comes to mind is that you're using the old repo, and not the new one.
Old:
https://github.com/dradis/dradis-legacy
New:
https://github.com/dradis/dradis-ce
Then make sure to run bundle install.
Also, check the official Install from Git guide.
Did you run
bundle install
? This will install all the gems specified in the Gemfile, which includes installing Rails.
bundle exec rails server
should work after that

Rubber installed but isn't usable?

I think there's something wrong with my setup.
I am trying to install Rubber following this guide:
https://github.com/rubber/rubber/wiki/Quick-Start
It appears that I installed rubber correctly...
$ sudo gem install rubber
$ Successfully installed rubber-2.7.4
$ 1 gem installed
But I cannot invoke it...
$ rubber vulcanize complete_passenger_postgresql
$ /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rubber (>= 0) amongst [actionmailer-4.0.3, actionmailer-4.0.2
I am confused. I use rvm and every gem should be stored inside ~/.rvm/gems. Why is the /usr/lib/ruby directory being involved at all?
Any help would be great
More info on my environment:
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /home/evan/.rvm/gems/ruby-2.1.0
- RUBY EXECUTABLE: /home/evan/.rvm/rubies/ruby-2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /home/evan/.rvm/gems/ruby-2.1.0/bin
- SPEC CACHE DIRECTORY: /home/evan/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/evan/.rvm/gems/ruby-2.1.0
- /home/evan/.rvm/gems/ruby-2.1.0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/evan/.opam/system/bin
- /home/evan/.rvm/gems/ruby-2.1.0/bin
- /home/evan/.rvm/gems/ruby-2.1.0#global/bin
- /home/evan/.rvm/rubies/ruby-2.1.0/bin
- /home/evan/Apps/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python2.7
- /usr/local/heroku/bin
- /usr/lib/lightdm/lightdm
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /home/evan/Apps/sketch_tar/sketch-1.6.4/sketch-frontend
- /home/evan/Apps/yices-1.0.39/bin
- /home/evan/Apps/arduino-1.0.5
- /home/evan/Apps/cil/cil-1.7.3/bin
- /home/evan/Apps/intellej/idea-IC-133.696/bin
- /home/evan/Apps/play-2.2.1
- /home/evan/Apps/scala-2.10.3/bin
- /home/evan/Apps/apache-maven-3.0.5/bin
- /home/evan/Apps/sublime/sublime2
- /home/evan/.rvm/bin
I got it!!
The problem is I was using rvm but I still prefixed my gem with sudo
i.e.
gem install ...
and
sudo gem install ...
has completely different environments. See this post:
Why do "gem" and "sudo gem" have different installation directories?
I was installing via "sudo gem install" but I was invoking the rubber command without sudo.

Resources