Trouble to bundle install some gems on production server - ruby-on-rails

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 ?

Related

Two versions of bundler installed and using the wrong one

I have the right version of Bundler installed:
docker#f5990915a8ae:/usr/src/app$ bundler version
Bundler version 2.2.17 (2021-05-05 commit 69cbd6e10e)
But when I run the db:migrate it seems that is using another one:
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.17). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.17.
This is my gem environment for the app:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /home/docker/.gem
- USER INSTALLATION DIRECTORY: /home/docker/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/bin/ruby2.7
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/docker/.gem/bin
- SPEC CACHE DIRECTORY: /home/docker/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/docker/.gem
- /home/docker/.gem/ruby/2.7.0
- /var/lib/gems/2.7.0
- /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/docker/.gem//bin
- /home/docker/.gem/ruby/2.7.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
These are the two bundler versions installed:
home/docker/.gem/specifications/bundler-2.2.17.gemspec
usr/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.4.gemspec
How do I make the db:migrate use the right one?
change to
bundle exec rake db:migrate
or change bundler version in Gemfile.lock

Rails does not find gem, although it is installed

I hope somebody can help, I am really confused about this. I want to use the gem svg-graph (github) within my rails app. But require 'svggraph' gives me this error: cannot load such file -- svg-graph, which I don't understand as running a script inside the app folder requiring the gem runs perfectly.
I have gem 'svg-graph' within my Gemfile and bundle installs ran successfully.
gem which svggraph gives me /Users/Username/.rvm/gems/ruby-2.3.3/gems/svg-graph-2.1.1/lib/svggraph.rb.
If it helps here's my output of gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.10
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/Username/.rvm/gems/ruby-2.3.3
- USER INSTALLATION DIRECTORY: /Users/Username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/Username/.rvm/rubies/ruby-2.3.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/Username/.rvm/gems/ruby-2.3.3/bin
- SPEC CACHE DIRECTORY: /Users/Username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/Username/.rvm/rubies/ruby-2.3.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/Username/.rvm/gems/ruby-2.3.3
- /Users/Username/.rvm/gems/ruby-2.3.3#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/Username/.rvm/gems/ruby-2.3.3/bin
- /Users/Username/.rvm/gems/ruby-2.3.3#global/bin
- /Users/Username/.rvm/rubies/ruby-2.3.3/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/bin
- /opt/X11/bin
- /usr/local/git/bin
- /usr/local/go/bin
- /usr/local/MacGPG2/bin
- /Library/TeX/texbin
- /Us
ers/Username/.rvm/bin

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

Rails can't find gumby-framework gem assets

I'm using a locally installed version of Cloud9 and Ruby on Rails. I've installed 'gumby-framework' and 'modernizr-rails' gems but when I add //= require modernizr to applications.js it can't find them.
When I run $ bundle install it lists both gems as installed. Here's what $ gem env comes back with:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /Users/name/.rvm/gems/ruby-2.2.0
- RUBY EXECUTABLE: /Users/name/.rvm/rubies/ruby-2.2.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/name/.rvm/gems/ruby-2.2.0/bin
- SPEC CACHE DIRECTORY: /Users/name/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/name/.rvm/rubies/ruby-2.2.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/name/.rvm/gems/ruby-2.2.0
- /Users/name/.rvm/gems/ruby-2.2.0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/name/.rvm/gems/ruby-2.2.0/bin
- /Users/name/.rvm/gems/ruby-2.2.0#global/bin
- /Users/name/.rvm/rubies/ruby-2.2.0/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/git/bin
- /Users/name/.rvm/gems/ruby-2.2.0/bin
- /Users/name/.rvm/gems/ruby-2.2.0#global/bin
- /Users/name/.rvm/rubies/ruby-2.2.0/bin
- /Users/name/.rvm/bin
The file path of my project is 'Users/name/c9sdk/quote_app'.
I've just started working with Rails so I know I must be missing something obvious, any help would be very much appreciated.

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