Rails does not find gem, although it is installed - ruby-on-rails

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

Related

Changing gem env

I am new to Using changing ruby and have been having a lot of trouble getting it to version 2.7.6 so that I can install the react native CLI. Previously I changed it to 2.7.5 thinking that would work, but it didn't. I am not sure how I did this. The reason I need 2.7.6 is so that I can install the bundler for cocoa pods for IOS. Here is the gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.6
- RUBY VERSION: 2.7.5 (2021-11-24 patchlevel 203) [x86_64-darwin22]
- INSTALLATION DIRECTORY: /Users/jonnywerthman/.rvm/gems/ruby-2.7.5
- USER INSTALLATION DIRECTORY: /Users/jonnywerthman/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /Users/jonnywerthman/.rvm/rubies/ruby-2.7.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/jonnywerthman/.rvm/gems/ruby-2.7.5/bin
- SPEC CACHE DIRECTORY: /Users/jonnywerthman/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/jonnywerthman/.rvm/rubies/ruby-2.7.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-22
- GEM PATHS:
- /Users/jonnywerthman/.rvm/gems/ruby-2.7.5
- /Users/jonnywerthman/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/jonnywerthman/.rvm/gems/ruby-2.7.5/bin
- /Users/jonnywerthman/.rvm/gems/ruby-2.7.5#global/bin
- /Users/jonnywerthman/.rvm/rubies/ruby-2.7.5/bin
- /Users/jonnywerthman/.rbenv/shims
- /Users/jonnywerthman/opt/miniconda3/bin
- /Users/jonnywerthman/opt/miniconda3/condabin
- /Library/Frameworks/Python.framework/Versions/3.10/bin
- /usr/local/bin
- /System/Cryptexes/App/usr/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/TeX/texbin
- /Library/Apple/usr/bin
- /Users/jonnywerthman/.rvm/bin
I need to make sure that it is switched to 2.7.6 and that the react native CLI actually reads it as 2.7.6 so that I can download the stuff I need.
I recommend using rbenv.
https://github.com/rbenv/rbenv
It is less intrusive than rvm.

Installed Rails but not able to run it?

I'm using asdf as a ruby package manager, I had a bunch of issues with the PATH environments and was able to install everything correctly. However, I'm running into issues with the rails gem.
I think I might still have ownership errors with it.
This is my path:
/Users/carlos.grijalva/.asdf/shims:/Users/carlos.grijalva/.asdf/bin:/Users/carlos.grijalva/.rbenv/bin:/Users/carlos.grijalva/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
This is which ruby:
/Users/carlos.grijalva/.asdf/shims/ruby
And this is ruby -v:
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
And this is my GEM environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /Users/carlos.grijalva/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/bin
- SPEC CACHE DIRECTORY: /Users/carlos.grijalva/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0
- /Users/carlos.grijalva/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/carlos.grijalva/.asdf/installs/ruby/2.5.3/bin
-
- /Users/carlos.grijalva/.asdf/shims
- /Users/carlos.grijalva/.asdf/bin
- /Users/carlos.grijalva/.rbenv/bin
- /Users/carlos.grijalva/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
You only want to use one ruby version manager. Make sure you remove anything related to RBEN if you're not using it as your version manager.
Have a look here for things you may need to do.
You should also check your shell for any PATH definitions you don't need regarding RBENV.

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.

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