Gems not found because installed in different locations - ruby-on-rails

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

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.

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

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