Installed Rails but not able to run it? - ruby-on-rails

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.

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.

rbenv wrong gem version in installation directory [duplicate]

This question already has an answer here:
Why is Ruby 1.9.2 on Windows 7 using a 1.9.1 path for gems? it is using c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb
(1 answer)
Closed 4 years ago.
I've been struggling with this for a while now. I want to use ruby-2.4.1 in my application and installed rbenv and also installed 2.4.1 with it.
I can confirm that ruby -v prints out 2.4.1 is being used.
gem env leads to the following:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.11
- RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/thementoria/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/thementoria/.rbenv/versions/2.4.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/bin
- SPEC CACHE DIRECTORY: /Users/thementoria/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/thementoria/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0
- /Users/thementoria/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/thementoria/.rbenv/versions/2.4.1/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- /Users/thementoria/.rbenv/bin
- /Users/thementoria/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/MacGPG2/bin
Note that my USER INSTALLATION DIRECTORY, INSTALLATION DIRECTORY and GEM PATHS have 2.4.0 in it.
What causes this to happen?
In my .bashrc I have:
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
Any help would be appreciated.
All is fine. Ruby assumes that all gems within a minor version are fully compatible.
This is probably based on a 20 year old decision which would allow you to transfer installed gems within patch versions of Rubies, by simply copying or symlinking them, without downloading them again. I doubt that the same decision would be made today.

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