Rubber installed but isn't usable? - ruby-on-rails

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.

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

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

Gems not found because installed in different locations

I have some gems that are not being found b/c I think they are installed in the wrong location. How can I fix this? My setup:
which gem allure-cucumber
/Users/qahq/.rvm/rubies/ruby-2.1.0/bin/gem
which gem cucumber
/Users/qahq/.rvm/rubies/ruby-2.1.0/bin/gem
/Users/qahq/.rvm/gems/ruby-2.1.0#idme-revelator/bin/cucumber
rvm gemset name
idme-revelator
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin14.0]
- INSTALLATION DIRECTORY: /Users/qahq/.rvm/gems/ruby-2.1.0#idme-revelator
- RUBY EXECUTABLE: /Users/qahq/.rvm/rubies/ruby-2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/qahq/.rvm/gems/ruby-2.1.0#idme-revelator/bin
- SPEC CACHE DIRECTORY: /Users/qahq/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/qahq/.rvm/rubies/ruby-2.1.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/qahq/.rvm/gems/ruby-2.1.0#idme-revelator
- /Users/qahq/.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:
- /Users/qahq/.rvm/gems/ruby-2.1.0#idme-revelator/bin
- /Users/qahq/.rvm/gems/ruby-2.1.0#global/bin
- /Users/qahq/.rvm/rubies/ruby-2.1.0/bin
- /Users/qahq/.rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
allure
-bash: allure: command not found
I'm guessing the allure command isn't working b/c it's not in the proper directory that cucumber is in, b/c the cucumber command works.
How can I fix this?
Try running it with bundle exec rails server

Error while gem install on ubuntu 12.04 aws ec2

I got a Ubuntu 12.04 instance in AWS EC2.
I just want to gem install rails.
But it shows this error message.
Is this caused by the difference gem env between sudo gem env?
Is there any ways to solve this problem except rvm implode?
What's the risk of using rvmsudo instead?
Fetching: atomic-1.1.15.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/rvm/gems/ruby-1.9.3-p545#global directory.
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545#global
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p545/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545#global/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p545#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/rvm/gems/ruby-1.9.3-p545#global/bin
- /usr/local/rvm/rubies/ruby-1.9.3-p545/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/rvm/bin
sudo gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/ubuntu/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
rvm is made to be used without sudo or specific/sudo rights.
reinstall would be more appreciated.
clean the current rvm install
rvmsudo rvm implode
sudo rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm
and then close all consoles/bashes/terminales and login in again with the user you want to use rvm with and install it again.
Is this caused by the difference gem env between sudo gem env?
Quite possibly, the rvm Ruby is separate and different from the system Ruby environment and depends on where what gem gets executed according to the path.
However, it looks like you are running an rvm Ruby gem install as a different user as the owner of /usr/local/rvm/gems and it's subdirectories, which is supposed to be installed as rvmsudo
What user are you running the rvm gem install as?
You can try this:
chown -R user-you-want-to-run-command-as.user-you-want-to-run-command-as /usr/local/rvm/gems
Or also try like you mentioned rvmsudo. The risk there as the some of the files may have root ownership which you may not want if you want to be more secure.
Note that rvmsudo is not the recommended way but rather use rvm on your local directory. If you'd like to remove it you can do this:
rvmsudo rvm implode
sudo rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm
Then reinstall with just rvm

Trouble to bundle install some gems on production server

I find some trouble to bundle install some gems like nokogiri, eventmachine, json, http_parser.rb, yajl-ruby on production server.
I use capistrano to deploy the app,
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/deployer/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
Results logged to /home/deployer/apps/yanny/shared/bundle/ruby/2.0.0/gems/gemname/ext/gem_make.out
Make sure that gem install X succeeds before bundling.
if i try to install missing gem through server it works and bundle install stops asking for it:
gem install x -v y --install-dir /home/deployer/apps/holo/shared/bundle/ruby/2.0.0/
here is my gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.1.11
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/deployer/.rvm/gems/ruby-2.0.0-p353
- RUBY EXECUTABLE: /home/deployer/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /home/deployer/.rvm/gems/ruby-2.0.0-p353/bin
- SPEC CACHE DIRECTORY: /home/deployer/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/deployer/.rvm/gems/ruby-2.0.0-p353
- /home/deployer/.rvm/gems/ruby-2.0.0-p353#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/deployer/.rvm/gems/ruby-2.0.0-p353/bin
- /home/deployer/.rvm/gems/ruby-2.0.0-p353#global/bin
- /home/deployer/.rvm/rubies/ruby-2.0.0-p353/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
Any ideas ?

Resources