Changing gem env - ruby-on-rails

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.

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

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.

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.

Resources