Ruby Not Detecting Gems - ruby

For some reason, Ruby can't seem to under stand that I installed the AppFog gem (af). When I run af, I get this:
/Users/myface13214/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find af (>= 0) amongst [Saikuro-1.1.0, actionmailer-3.2.8, actionpack-3.2.8, activemodel-3.2.8, activerecord-3.2.8, activeresource-3.2.8, activesupport-3.2.8, arel-3.0.2, awesome_print-1.1.0, bcrypt-ruby-3.0.1, bourbon-2.1.2, builder-3.0.4, cancan-1.6.8, capistrano-2.13.5, capybara-2.0.0, cgi_multipart_eof_fix-2.5.0, childprocess-0.3.6, chronic-0.3.0, chunky_png-1.2.6, churn-0.0.24, code_analyzer-0.3.0, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.4.0, colored-1.2, compass-0.12.2, compass-rails-1.0.3, configatron-2.9.1, cover_me-1.2.0, daemons-1.1.9, daemons-1.0.10, devise-2.1.2, diff-lcs-1.1.3, erubis-2.7.0, excon-0.16.10, execjs-1.4.0, factory_girl-4.1.0, factory_girl_rails-4.1.0, fastthread-1.0.7, ffi-1.1.5, figaro-0.5.0, flay-1.4.3, flog-2.5.3, fssm-0.2.9, gem_plugin-0.2.3, hashie-1.2.0, highline-1.6.15, hike-1.2.1, hirb-0.7.0, i18n-0.6.1, journey-1.0.4, jquery-rails-2.1.3, json-1.7.5, json_pure-1.7.5, kgio-2.7.4, libwebsocket-0.1.6, mail-2.4.4, main-4.7.1, metric_fu-2.1.1, metrical-0.1.0, mime-types-1.19, mongrel-1.2.0.pre2, multi_json-1.3.7, net-scp-1.0.4, net-sftp-2.0.5, net-ssh-2.6.1, net-ssh-gateway-1.1.0, nokogiri-1.5.5, orm_adapter-0.4.0, polyglot-0.3.3, progressbar-0.11.0, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.2, rails-3.2.8, rails_best_practices-1.12.0, railties-3.2.8, raindrops-0.10.0, rake-10.0.1, rcov-0.9.11, rdoc-3.12, reek-1.2.12, ripper_ruby_parser-0.0.8, roodi-2.1.0, rspec-core-2.12.0, rspec-expectations-2.12.0, rspec-mocks-2.12.0, rspec-rails-2.12.0, ruby2ruby-1.2.5, ruby_parser-2.3.1, rubyzip-0.9.9, sass-3.2.3, sass-rails-3.2.5, selenium-webdriver-2.26.0, sexp_processor-3.2.0, sprockets-2.1.3, sqlite3-1.3.6, syntax-1.0.0, thor-0.16.0, tilt-1.3.3, treetop-1.4.12, tzinfo-0.3.35, uglifier-1.3.0, unicorn-4.4.0, vcr-2.3.0, warden-1.2.1, websocket-1.0.2, xpath-1.0.0, yamler-0.1.0] (Gem::LoadError)
from /Users/myface13214/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/myface13214/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /Users/myface13214/.rvm/gems/ruby-1.9.3-p327/bin/af:18:in `<main>'
from /Users/myface13214/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/myface13214/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
This is even after installing it. For some reason gem install won't install it.
If it helps, I'm running 1.9.3 installed through RVM.

You didn't really show what you were using it with, so I am going to outline some troubleshooting and installation steps that I have used to install this. A clean gemset, the latest rvm, and recording it as I do it to post here.
The first thing you will want to confirm is your rvm environment. I did these two steps:
$: rvm get head
$: rvm use 1.9.3-p327
And then:
$: rvm info
which finally gives me this report:
ruby-1.9.3-p327#CleanProject:
system:
uname: "Linux lazurus 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 i686 i386 GNU/Linux"
system: "debian/wheezy_sid/i386"
bash: "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.16.20 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "13 minutes 59 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p327"
date: "2012-11-10"
platform: "i686-linux"
patchlevel: "2012-11-10 revision 37606"
full_version: "ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]"
homes:
gem: "/home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject"
ruby: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327"
binaries:
ruby: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327/bin/ruby"
irb: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327/bin/irb"
gem: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327/bin/gem"
rake: "/home/some_user/.rvm/gems/ruby-1.9.3-p327#global/bin/rake"
environment:
PATH: "/home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject/bin:/home/some_user/.rvm/gems/ruby-1.9.3-p327#global/bin:/home/some_user/.rvm/rubies/ruby-1.9.3-p327/bin:/home/some_user/.rvm/bin:/usr/local/heroku/bin:/home/some_user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin"
GEM_HOME: "/home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject"
GEM_PATH: "/home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject:/home/some_user/.rvm/gems/ruby-1.9.3-p327#global"
MY_RUBY_HOME: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327"
IRBRC: "/home/some_user/.rvm/rubies/ruby-1.9.3-p327/.irbrc"
RUBYOPT: ""
gemset: "CleanProject"
I have a clean gemset, no Gemfile so no bundle install. Simply this:
$: gem install af --no-rdoc --no-ri
Fetching: json_pure-1.6.7.gem (100%)
Fetching: rubyzip-0.9.9.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: rest-client-1.6.7.gem (100%)
Fetching: terminal-table-1.4.5.gem (100%)
Fetching: interact-0.4.8.gem (100%)
Fetching: addressable-2.2.8.gem (100%)
Fetching: uuidtools-2.1.3.gem (100%)
Fetching: rb-readline-0.4.2.gem (100%)
Fetching: af-0.3.18.11.gem (100%)
Successfully installed json_pure-1.6.7
Successfully installed rubyzip-0.9.9
Successfully installed mime-types-1.19
Successfully installed rest-client-1.6.7
Successfully installed terminal-table-1.4.5
Successfully installed interact-0.4.8
Successfully installed addressable-2.2.8
Successfully installed uuidtools-2.1.3
Successfully installed rb-readline-0.4.2
Successfully installed af-0.3.18.11
10 gems installed
Then I check for the gems binary, so that I know it installs it.
$: which af
/home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject/bin/af
And when I do an directory listing:
$: ls /home/some_user/.rvm/gems/ruby-1.9.3-p327#CleanProject/bin/
af
restclient
This is where it seems yours breaks...
$: af
Usage: af [options] command [<args>] [command_options]
Try 'af help [command]' or 'af help options' for more information.
And further, I can run the help option:
$: af help
I get the help screen
Usage: af [options] command [<args>] [command_options]
Try 'af help [command]' or 'af help options' for more information.
Currently available af commands are:
Getting Started
target [url] Reports current target or sets a new
|
| quite a few lines cut out for brevity's sake
|
Help
help [command] Get general help or help on a specific command
help options Get help on available options
Of course, when I check the folders that are reflected in the rvm info, I see the af binary alongside the others.

Sometimes rvm may not be fully engaged which means your $GEM_PATH environment variable is not set correctly. Typically rvm use 1.9.3 will fix that.
It may be that your rvm install is out of date or needs to be adjusted so that your default Ruby is set correctly.

please do the following, in the project root:
rvm use 1.9.3
rvm gemset create your-project-name
rvm gemset use your-project-name
bundle install
And see if everything s working as expected.

Related

Installed Ruby gems appear to exist on disk, but can't be found when run or referenced by other gems

I'm trying to install Ruby on Rails on my openSUSE Tumbleweed machine and running into some problems.
First, I installed rvm:
curl -L get.rvm.io | bash -s stable
Then I used it to install Ruby 2.3.1:
rvm install 2.3.1
rvm use 2.3.1 --default
Then I configured gem to install to my home directory, not /:
$ cat ~/.gemrc
gem: --user-install
Then I used gem to install bundler:
gem install bundler
That's where I ran into problems. The installation seemed to complete fine:
$ gem install bundler
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Done installing documentation for bundler after 3 seconds
1 gem installed
and I can see it on disk:
$ which bundler
/home/<me>/.gem/ruby/2.3.0/bin/bundler
$ > ls ~/.gem/ruby/2.3.0/gems/bundler-1.14.6/
bin CODE_OF_CONDUCT.md exe LICENSE.md README.md
bundler.gemspec CONTRIBUTING.md ISSUES.md man
CHANGELOG.md DEVELOPMENT.md lib Rakefile
But it doesn't actually run, giving a really weird error message:
$ bundler -v
/home/<me>/.rvm/rubies/ruby-2.3.1/lib64/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
from /home/<me>/.rvm/rubies/ruby-2.3.1/lib64/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
from /home/<me>/.gem/ruby/2.3.0/bin/bundler:22:in `<main>'
And sure enough, gem list doesn't see it:
$ gem list | grep -i bundler | wc -l
0
I get a similar problem when trying to run rails; it complains that it can't find railties, even though it is clearly installed on disk in ~/.gem/ruby/2.3.0/gems, and gem list doesn't show it.
What's going on here?
First select rvm source by command:
source ~/.rvm/scripts/rvm
and then try.

Using Bundler, RVM and RubyGems

I seem to be getting an odd issue here, not sure where to look to debug it. I have had Ruby installed on my machine for a while now but today have added RVM. So I will run through the steps I am taking:
My Gemfile:
source 'https://rubygems.org'
gem 'capistrano', '~> 3.1.0'
Try to install:
$ bundle
Fetching gem metadata from https://rubygems.org/.......
Installing rake (10.2.1)
Gem::InstallError: rake requires Ruby version >= 1.9.
An error occured while installing rake (10.2.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.2.1'` succeeds before bundling.
Check Ruby version, which is greater than 1.9:
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Make sure rake is installed:
$ gem list
*** LOCAL GEMS ***
...
rake (10.2.1)
...
Try installing rake anyway:
$ sudo gem install rake -v '10.2.1'
Successfully installed rake-10.2.1
Parsing documentation for rake-10.2.1
1 gem installed
Make sure rake is installed:
$ gem list
*** LOCAL GEMS ***
...
rake (10.2.1)
...
Try again:
$ bundle
Fetching gem metadata from https://rubygems.org/.......
Installing rake (10.2.1)
Gem::InstallError: rake requires Ruby version >= 1.9.
An error occured while installing rake (10.2.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.2.1'` succeeds before bundling.
Perhaps some useful information:
$ rvm info
system:
system:
uname: "Darwin ians-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.22 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 34 minutes 31 seconds ago"
path: "/Users/ianjamieson/.rvm"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/android-developer-tools/sdk/platform-tools:/Applications/android-developer-tools/sdk/tools:/usr/lib/apache-ant-1.9.2/bin:/usr/local/mysql/bin:/Applications/android-developer-tools/sdk/platform-tools:/Applications/android-developer-tools/sdk/tools::/usr/lib/apache-ant-1.9.2/bin:/usr/local/mysql/bin:/Users/ianjamieson/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
Thanks.
The fix for me was:
$ rvm reinstall 2.1.1
It seems as though, when I installed this version the first time round it didn't complete correctly and didn't update all the paths. So gem install was installing my gems in the wrong place.

ERROR: Error installing jekyll: ERROR: Failed to build gem native extension

My system has:
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
gem -version 2.2.2
devKit : DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
When I try to run gem install jekyll, I get this error:
D:\devKit>gem install jekyll
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
"D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe" extconf.rb
D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe: invalid switch in RUBYOPT: -F (
RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in D:/Program Files (x86)/Ruby200-x64/lib/ruby/g
ems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to D:/Program Files (x86)/Ruby200-x64/lib/ruby/gems/2.0.0/extensi
ons/x64-mingw32/2.0.0/fast-stemmer-1.0.2/gem_make.out
I got this error while installing Jekyll on Linux (Mint 17, which is based on Ubuntu 14.04).
I eventually found the solution here. I needed both the ruby-dev package and nodejs (the latter due to a bug in Jekyll).
sudo apt-get install ruby ruby-dev make
sudo gem install jekyll --no-rdoc --no-ri
sudo apt-get install nodejs
I ran into this problem too. Running the following installed Jekyll for me:
$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
$ sudo gem install jekyll
This installs RVM, updates Rails and installs Jekyll.
BTW - Most of the posts I've found indicate it's a problem with Xcode not having the developer tools installed. I have a newer MacBook Pro on which this stuff was installed by default, so attempting to install the Xcode dev tools did nothing for me (unlike the above, which did everything I needed).
try
gem update
then
gem install jekyll
And you may want to try with Ruby 1.9.3 and compatible DevKit.

Will running sudo apt-get install ruby1.9.1-dev disturb rvm?

I have already installed rvm and few versions of rubies. Here is the list
$ rvm list
rvm rubies
ruby-1.9.1-p431-dev [ i686 ]
=> ruby-1.9.3-p484 [ i686 ]
* ruby-2.0.0-p247 [ i686 ]
ruby-2.0.0-p353 [ i686 ]
# => - current
# =* - current && default
# * - default
I tried sudo gem install jekyll in all versions but getting the same error again and again
sudo gem instal jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2/ext/gem_make.out
How to proceed with the Jekyll installation.
When reading about Troubleshooting Installation Problem they have mentioned to Install ruby1.9.1-dev package through
sudo apt-get install ruby1.9.1-dev
Will it solve my issue without disturbing the rvm?
Please guide me.
It seems either the build of ruby-1.9.1 isn't completed, or some of build-in modules for the ruby are absent, for example mkmf. So you have to add-in the module into the ruby-1.9.1 installation if any, in order to be able to build native gems with the ruby.
When reading about Troubleshooting Installation Problem they have mentioned to Install ruby1.9.1-dev package through
sudo apt-get install ruby1.9.1-dev
Of course try to install, and then do in irb of the ruby-1.9.1:
require 'mkmf'

'gem install -v' installs wrong version of a gem

I'd like to install bundler v1.2.3 on my machine.
First, I checked out the remote gem repo whether that version of the gem exists:
$ gem list --remote | grep "^bundler "
bundler (1.2.3)
Then I tried to install the gem, but a different version(v1.1.5):
$ sudo gem install bundler -v '1.2.3'
Successfully installed bundler-1.1.5
1 gem installed
Installing ri documentation for bundler-1.1.5...
Installing RDoc documentation for bundler-1.1.5...
Why is this happening and is there any solution for this problem?
Thanks!
Just tested on my Mac running 10.8, worked no problem. I had Bundler 1.3.5 already installed.
andys-MacBook-Pro:.gem uw$ gem list 'bundler'
*** LOCAL GEMS ***
bundler (1.3.5)
andys-MacBook-Pro:.gem uw$ gem install 'bundler' -v '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
Parsing documentation for bundler-1.2.3
Installing ri documentation for bundler-1.2.3
1 gem installed
I'm getting the gem (bundler 1.2.3) installed properly in my Win 7 32 bit machine. give a try again
C:\Windows\System32>gem install bundler -v 1.2.3
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
Installing ri documentation for bundler-1.2.3...
Installing RDoc documentation for bundler-1.2.3...
When I used gem install bundler '1.2.3'
I got the following.
PS C:\Users\....> gem install bundler '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
ERROR: Could not find a valid gem '1.2.3' (>= 0) in any repository
But it worked fine when I remove the quotation marks and just used
gem install bundler 1.2.3
EDIT ~ Didn't see the comment to the previous answer. Looks like this question is already solved.
I noticed that you use sudo to do the install but not to do the list. This can sometimes cause a problem, especially if you have multiple versions of ruby/gem installed (or if you use rvm).
I've also seen oddities like this if one of the gems is not using rubygems.org as the default gemserver. What does $ sudo gem list --remote | grep "^bundler " give you?
It may not matter but what version of ruby are you using?

Resources