can't find Bundler - ruby-on-rails

I'm trying to get bundler working on my Dreamhost account. when I type bundle update in my application I get
-bash: bundle: command not found
I installed bundler 1.0.15 in gem bundler
gem environment results in:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/tarscher/gems
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /home/tarscher/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/tarscher/gems
- /usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gempath" => ["/home/tarscher/gems", "/usr/lib/ruby/gems/1.8"]
- "gemhome" => "/home/tarscher/gems"
- REMOTE SOURCES:
- http://rubygems.org/
I configured my .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
PATH=$PATH:/usr/lib/ruby/gems/1.8/bin;/home/myuser/gems/bin
and my .gemrc
gemhome: /home/myuser/gems
gempath:
- /home/tarscher/gems
- /usr/lib/ruby/gems/1.8
UPDATE
When I go into /home/myuser/gems/binwhere the bundle script is located dir and type bundle I also get -bash: bundle: command not found .
Someone knows why bundler isn't found?
Thanks

There's an error here:
PATH=$PATH:/usr/lib/ruby/gems/1.8/bin;/home/myuser/gems/bin
The paths must be separated by :, not ;

Related

bash: bundle: command not found even though bundler is installed

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

rails c throws error bin_path': can't find executable rails for rails-3.2.8 (Gem::Exception)

I am trying to open rails console in production mode and it throws below error,
/usr/local/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path':
can't find executable rails for rails-3.2.8 (Gem::Exception)
from /usr/local/bin/rails:19:in `<main>'
I have not used rvm. Other commands like rake:xyz runs properly. Output of $gem env is as follows,
RubyGems Environment:
RUBYGEMS VERSION: 1.3.7
RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux]
INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
RUBY EXECUTABLE: /usr/local/bin/ruby
EXECUTABLE DIRECTORY: /usr/local/bin
RUBYGEMS PLATFORMS:
ruby
x86_64-linux
GEM PATHS:
/usr/local/lib/ruby/gems/1.9.1
/root/.gem/ruby/1.9.1
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:benchmark => false
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
http://rubygems.org/
Please let me know what needs to be. I cannot go for bundle install, etc as its production env and there are few tasks running. I dont want to break existing tasks / processes
It worked by using,
RAILS_ENV=production bundle exec rails c
Being a beginner,I have tried the same on my system and I got into the rails console.In fact my gem env resulted in
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /home/mmohan/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
On reading the error, gem is found to be outdated. The best method to tackle it is by updating gem to latest one. If for assistance, check thishttp://www.coval.nl/blog/?p=18

Gem environment/install location and bundler

it's been a while since I setup a brand new Rails environment.
I am trying to get gems to install under ~/.gems as opposed to /usr to avoid sudo-ing constantly.
Here is my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/myname/.gems
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /home/myname/.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/myname/.gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- "gemhome" => "/home/myname/.gems"
- "gempath" => ["/home/myname/.gems"]
- REMOTE SOURCES:
- https://rubygems.org/
$ which bundle
/home/myname/.gems/bin/bundle
now I did rails new SomeApp and when I run
bundle install
I get:
Errno::EACCES: Permission denied - /usr/local/lib/ruby/gems/2.0.0/build_info/jquery-rails-3.0.4.info
An error occurred while installing jquery-rails (3.0.4), and Bundler cannot continue
Which tells me that it's still trying to install the gem NOT where I want it. Any thoughts what to check? (I do have a ~/.gemrc file, the contents are the last 3 lines of the GEM CONFIGURATION section above).
Many thanks for all tips -- this was supposed to be a quick and easy step :)
highly recommend rbenv and rbenv-gemset, installing here with homebrew:
brew install rbenv rbenv-gemset
cd into/project/
echo specialgemsetname > .rbenv-gemsets
now start a new terminal (to ensure environment is correct) and setup your project.

RVM gem permissions error

I started trying to set up a local rails installation for development. After I installed in using apt-get, however, I learned about RVM, so I removed the earlier one, and reinstalled from RVM. It looks like I have residual problems, though. Specifically, when I try to install rails I get...
$ gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.9.1 directory.
This already looks like a problem, because I don't want it to be in the /var/ directory, I want it to be in the user directory. So, I check the following...
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /home/myusername/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
As well as sudo'd:
$ sudo gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /home/myusername/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
gems seem to live in /var/lib for some reason. Is this normal? How can I fix this so I can install the rails gem?
EDIT: UPDATE!
It appears to me that I have gems installed twice, once in /var/lib/gems/1.9.91 (bad) and once in /home/myusername/.gem/ruby/1.9.1 (good).
I think what is happening here is that when I type "gem" the installation in /var/lib/gems/1.9.1 (bad) is taking priority over /home/myusername/.gem/ruby/1.9.1 (good). Can anyone confirm that? Also, would it be OK and fix things just to delete the bad directory, or would that cause problems?
You missed to use ruby, you can do it with:
rvm use 1.9.3 --install
In case 1.9.3 was not installed, this command will also install it!
It also looks you are using Ubuntu, make sure you are not using RVM from Ubuntu package - that thing is broken! You can find instruction how to fix it here: https://stackoverflow.com/a/9056395/497756

What does this error mean?

Just looking for a super simple answer here.
My app returns this :
Error message:
git://github.com/spree/spree.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
Exception class:
PhusionPassenger::UnknownError
Application root:
/home/shadyfront/webapps/revolting_age/Age-of-Revolt
What does that mean, "is not checked out" ?
I have here in my nginx.conf :
env GEM_HOME=/home/shadyfront/.rvm/gems/ruby-1.8.7-p330#revolting_gems;
When I perform bundle show spree:
#> /home/shadyfront/.rvm/gems/ruby-1.8.7-p330#revolt/bundler/gems/spree-1706124f2f94
And I have here in my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.5.2
- RUBY VERSION: 1.8.7 (2010-12-23 patchlevel 330) [i686-linux]
- INSTALLATION DIRECTORY: /home/shadyfront/.rvm/gems/ruby-1.8.7-p330#revolting_gems
- RUBY EXECUTABLE: /home/shadyfront/.rvm/rubies/ruby-1.8.7-p330/bin/ruby
- EXECUTABLE DIRECTORY: /home/shadyfront/.rvm/gems/ruby-1.8.7-p330#revolting_gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/shadyfront/.rvm/gems/ruby-1.8.7-p330#revolting_gems
- /home/shadyfront/.rvm/gems/ruby-1.8.7-p330#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
bundle install passes everytime.
It means you don't have the source code for spree checked out from its git repository. Have you run bundle install like the error message suggests?
Have you tried bundle pack? Looks like a similar problem to this question: deploying rails3 apps with bundler and phusion passenger: .bundle dir not found

Resources