➜ ~ cloudapp Desktop/test.txt
You need to install cloudapp_api: gem install cloudapp_api
➜ ~ sudo gem install cloudapp_api
Password:
Successfully installed cloudapp_api-0.3.1
1 gem installed
Installing ri documentation for cloudapp_api-0.3.1...
Installing RDoc documentation for cloudapp_api-0.3.1...
➜ ~ cloudapp ~/Desktop/test.txt
You need to install cloudapp_api: gem install cloudapp_api
➜ ~ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/bkern/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
➜ ~
➜ ~ which ruby
/usr/bin/ruby
~ ls -ls /usr/bin/ruby
8 lrwxr-xr-x 1 root wheel 76 Mar 23 10:16 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
➜ ~ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
I am not sure how to resolve this. Any help would be appreciated. I am running snow leopard.
Gem.all_load_paths.grep /cloudapp/
NOTE: Gem.all_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_load_paths called from (irb):7.
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_partials called from /Library/Ruby/Site/1.8/rubygems.rb:260.
NoMethodError: undefined method specifications' for "/Library/Ruby/Gems/1.8":String
from /Library/Ruby/Site/1.8/rubygems.rb:425:ineach_load_path'
from /Library/Ruby/Site/1.8/rubygems.rb:423:in each'
from /Library/Ruby/Site/1.8/rubygems.rb:423:ineach_load_path'
from /Library/Ruby/Site/1.8/rubygems.rb:260:in _deprecated_all_load_paths'
from /Library/Ruby/Site/1.8/rubygems.rb:259:ineach'
from /Library/Ruby/Site/1.8/rubygems.rb:259:in _deprecated_all_load_paths'
from /Library/Ruby/Site/1.8/rubygems/deprecate.rb:62:insend'
from /Library/Ruby/Site/1.8/rubygems/deprecate.rb:62:in `all_load_paths'
from (irb):7
The cloudapp binary is very simple..it begins like this:
require 'rubygems'
begin
require 'cloudapp_api'
rescue LoadError
puts "You need to install cloudapp_api: gem install cloudapp_api"
exit!(1)
end
Here's what I would do:
"Make sure you have it plugged in fix": reinstall cloudapp (not the api, just the app).
In a clean irb (start with irb -f). Can you require cloudapp_api there (remember to require rubygems first)?
Check the bang-line (the first line) of the cloudapp binary (use which cloudapp to locate it). Is it running under the correct ruby binary?
These are the first steps of troubleshooting..let's see what you get..
Related
I recently installed Ruby 2.0.0 on OS X 10.8.3 by compiling from source code. I checked the version with
$ ruby --version
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
And I checked my gem version with
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-12
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/ehartsuyker/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :benchmark => false
- :sources => ["http://rubygems.org/", "http://gemcutter.org"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gemcutter.org
I noticed that the reported version of Ruby here does not match the version I installed. I don't know if this matters or not.
I have a simple piece of code called encrypy.rb that I'm running. After installing the 'rsa' gem with gem install rsa.
require 'rubygems'
require 'rsa'
key = RSA::KeyPair.generate(128)
ciphertext = key.encrypt("message")
puts(ciphertext)
When I run it, it gives an error saying it can't find the gem.
$ ruby encrypt.rb -Idirectory '/Library/Ruby/Gems/1.8'
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- rsa (LoadError)
from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from encrypt.rb:2:in `<main>'
So the question is, why isn't Ruby finding the gem despite seeming to know where it is? And how can I fix it?
Ruby 1.8.7 is shipped with OS X. It seems that gem is seeing that version instead of your manually installed 2.0.0. As others already suggested, using RVM or rbenv (which one depends on personal preference) makes handling different ruby environments much easier. You can find those tools and descriptions for them in the following places:
RVM: https://rvm.io/
rbenv: https://github.com/sstephenson/rbenv
I am getting an error while running bundle install in my rails project.
sahil#debian:~/workspace/blog$ bundle install
/usr/bin/env: ruby: No such file or directory
Ruby
sahil#debian:~/workspace/blog$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86__64-linux]
sahil#debian:~/workspace/blog$ which ruby
/home/sahil/.rvm/bin/ruby
Received the below error while installing ruby through rvm.
Error running 'env GEM_PATH=/home/sahil/.rvm/gems/ruby-2.0.0-p0:/home/sahil/.rvm/gems/ruby-2.0.0-p0#global:/home/sahil/.rvm/gems/ruby-2.0.0-p0:/home/sahil/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/home/sahil/.rvm/gems/ruby-2.0.0-p0 /home/sahil/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /home/sahil/.rvm/src/rubygems-2.0.3/setup.rb --verbose',
please read /home/sahil/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
rvm env
sahil#debian:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/sahil/.rvm/gems/ruby-2.0.0-p0
- RUBY EXECUTABLE: /home/sahil/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/sahil/.rvm/gems/ruby-2.0.0-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/sahil/.rvm/gems/ruby-2.0.0-p0
- /home/sahil/.rvm/gems/ruby-2.0.0-p0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => t
rvm env looks ok. Not sure what have I missed.
please follow this basics steps for using RVM (copied from https://stackoverflow.com/a/15570121/497756):
rvm install 2.0.0
rvm use 2.0.0 --default # The default arg is needed only first time
gem install bundler
bundle install
also another answer showing more details: https://stackoverflow.com/a/10591301/497756
I'm using Arch Linux with Zsh.
I installed RVM follow the official document :
$ curl -L https://get.rvm.io | bash -s stable --ruby
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.zshrc
$ source ~/.zshrc
$ rvm use 1.9.2 --default
After installed RVM. Every gem I installed show me the Gem::LoadError error like this :
$ gem install huami
$ huami
/home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find huami (>= 0) amongst [] (Gem::LoadError)
from /home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /home/meck/.gem/ruby/1.9.1/bin/huami:22:in `<main>'
And gem list is empty :
$ gem list
*** LOCAL GEMS ***
This is my gem env :
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.2 (2012-04-20 patchlevel 320) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/meck/.rvm/gems/ruby-1.9.2-p320#global
- RUBY EXECUTABLE: /home/meck/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
- EXECUTABLE DIRECTORY: /home/meck/.rvm/gems/ruby-1.9.2-p320#global/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/meck/.rvm/gems/ruby-1.9.2-p320#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/"]
- "gem" => "--user-install"
- REMOTE SOURCES:
- http://rubygems.org/
Could anybody point out what step did I miss?
RVM doesn't work very will with oh-my-zsh. oh-my-zsh likes to control a lot of your shell experience. Your mileage will vary. Certain extensions will conflict with RVM's operation. Hop in IRC Freenode #rvm if you encounter issues as they can provide direct and quick help with oh-my-zsh.
I was having some trouble running some Ruby scripts. While trying to get these scripts to run I tried lots of different things as well as updating rubygems as I thought this may be the problem. Since then I can't get any Ruby scripts to run.
I think that if I can revert rubygems back to it's original version I may be able to run Ruby scripts again, but I don't know how.
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/ryan/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]
$ which -a ruby
/opt/local/bin/ruby
/opt/local/bin/ruby
/usr/bin/ruby
/usr/local/bin/ruby
$ which -a gem
/usr/bin/gem
/usr/local/bin/gem
Thank you for any help in advance.
Ryan
$ ruby spidr_start_at.rb
spidr_start_at.rb:1:in `require': no such file to load -- rubygems (LoadError)
from spidr_start_at.rb:1
$ cat spidr_start_at.rb
require 'rubygems'
require 'uri'
require 'spidr'
url = 'http://www.ethicalhack3r.co.uk'
puts "Spidr.start_at()"
puts
Spidr.start_at(url, :depth => 1) do |spider|
spider.every_page do |page|
puts page.url.to_s
end
end
It seems that you have multiple versions of ruby(and gem) installed. It is advised to use rvm when maintaining multiple ruby versions. Or clean up your wrong/old/unneeded installations.
For downgrading Rubygems, you can do the following:
sudo gem update --system VERSION
You obviously have to put a real version there.
On my ubuntu box, irb (ruby) gives a NameError when I try to use the mechanize gem:
$ irb
irb(main):001:0> require 'mechanize'
=> true
irb(main):002:0> Mechanize.new
NameError: uninitialized constant Mechanize
from (irb):2
from :0
gem env shows this:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /var/lib/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :gempath => ["/var/lib/gems/1.8", "/usr/lib/ruby/gems/1.8"]
- REMOTE SOURCES:
- http://rubygems.org/
gem list shows it's installed:
$ gem list mech
*** LOCAL GEMS ***
mechanize (1.0.0)
it's in both paths in the filesystem:
$ ls -1 /var/lib/gems/1.8/gems/ |grep mech
mechanize-1.0.0
$ ls -1 /usr/lib/ruby/gems/1.8/gems |grep mech
mechanize-1.0.0
RubyGems is up to date:
$ gem update --system
Updating RubyGems
Nothing to update
# gem list rubygems
*** LOCAL GEMS ***
rubygems-update (1.3.7)
I have an up-to-date ruby:
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Here's what ubuntu gems packages I have (note that I installed rubygems-update and ran update_rubygems):
# dpkg -l rubygems*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==================-==================-====================================================
ii rubygems 1.3.5-1ubuntu2 package management framework for Ruby libraries/appl
ii rubygems-doc 1.3.5-1ubuntu2 package management framework for Ruby libraries/appl
ii rubygems1.8 1.3.5-1ubuntu2 package management framework for Ruby libraries/appl
try to create the class using
WWW::Mechanize.new