C:\Users\wipe\Quora-Personal-Analytics>ruby hello.rb
hello
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original
_require': no such file to load -- bundler/setup (LoadError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from hello.rb:4
C:\Users\wipe\Quora-Personal-Analytics>ruby require 'date'
ruby: No such file or directory -- require (LoadError)
C:\Users\wipe\Quora-Personal-Analytics>ruby require 'rubygems'
ruby: No such file or directory -- require (LoadError)
C:\Users\wipe\Quora-Personal-Analytics>
===
I'm using Ruby 1.8.7. Also, this worked before (on the same computer).
The require statements all do work when I try things from interactive ruby.So they all are installed. But I need the command line.
==
Edit: Here are the contents of Hello.rb
puts "hello"
require 'rubygems'
require 'bundler/setup'
require 'date'
require 'watir'
require 'optparse'
And some new error:
C:\Users\wipe\Quora-Personal-Analytics>ruby require 'rubygems'
ruby: No such file or directory -- require (LoadError)
C:\Users\wipe\Quora-Personal-Analytics>ruby hello.rb
hello
←[31mCould not find OptionParser-0.5.1 in any of the sources←[0m
←[33mRun `bundle install` to install missing gems.←[0m
C:\Users\wipe\Quora-Personal-Analytics>ruby bundle install
ruby: No such file or directory -- bundle (LoadError)
C:\Users\wipe\Quora-Personal-Analytics>ruby -e "require 'date'"
C:\Users\wipe\Quora-Personal-Analytics>ruby -e "require 'rubygems'"
C:\Users\wipe\Quora-Personal-Analytics>ruby QuoraStats.rb "firstname-lastname"
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original
_require': no such file to load -- httparty (LoadError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from ./lib/Content.rb:1
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from QuoraStats.rb:10
Somehow, ruby bundle install doesn't work very well:
C:\Users\wipe\Quora-Personal-Analytics>ruby bundle install
ruby: No such file or directory -- bundle (LoadError)
It looks like you don't have bundler installed. Try running gem install bundler, and then rerun ruby hello.rb.
Also, the two last commands you're typing won't work. ruby require 'date' is going to try to run the file "require" and pass it the argument 'date', not execute require 'date'. To just execute one line of ruby, use the -e flag, like this:
ruby -e "require 'date'"
Your stacktrace says
`gem_original
_require': no such file to load -- bundler/setup (LoadError)
Did you make sure bundler is actually installed? If not, try
gem install bundler
and retry.
Edit:
With the new errors you receive, simply try running
`bundle install`
then try again.
Related
My default ruby is 2.0.0p384.
A ruby script has:
#!/usr/bin/env ruby
require 'rubygems'
require 'httparty'
If the above header is changed to:
#!/usr/bin/ruby1.9.1
the script runs fine.
/var/lib/gems/2.0.0/gems/httparty-0.13.5 exists.
I can't understand why running the script with the 2.0.0 ruby gives:
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in require': cannot load such file -- httparty (LoadError) from usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:inrequire' from ./check_pingdom:30:in `'
When I type
gem list
I see the following
...
activerecord (3.2.17, 3.2.13)
...
But when I type this
cat >> does_ar_exist.rb
require 'activerecord'
ActiveRecord
ruby does_ar_exist.rb
I get the following error:
/Users/xxxxxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- activerecord (LoadError)
from /Users/xxxxxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:51:in `require'
Does anyone know why this is happening?
You have to do:
require 'active_record'
instead of require 'activerecord', since the file you want to load is active_record.rb.
I want to start my app using thin server
In config.ru
require 'sinatra'
require 'app'
run Sinatra.application
they are on the same directory
kithokit#19:05:26 hello (master) $ ls config.ru app.rb
app.rb config.ru
but i still got this error
kithokit#19:05:14 meet-api (master) $ thin start
Using rack adapter
/home/kithokit/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- app (LoadError)
from /home/kithokit/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
Change this line
require 'app'
to
require './app'
for more alternatives also see: Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?
When I try to require the tagfile/tagfile which is part of rtaglib I get a LoadError:
$ ruby main.rb
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- tagfile/tagfile (LoadError)
from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from main.rb:4:in `<main>'
I installed rtaglib with
$ gem install rtaglib
Here is the top part of my main.rb:
require 'date'
require 'find'
require 'tagfile/tagfile'
None of the suggestions here (Problem with Ruby + rtaglib gem) work. taglib is installed (1.7.2)
Trying it with other gems, like sinatra, works perfectly. Does anyone know the reason I cannot load rtaglib?
Can't you just require 'tagfile'? I just tried it and it worked fine.
I'm scripting with Ruby 1.9.2dev in Backtrack 5 but I'm having some problems when try to parse html entities with the library "htmlentities".
I cannot load the library although I have installed it with gem.
I'll show you the problems I'm having in the console:
root#bt:~# gem list -d htmlentities
*** LOCAL GEMS ***
htmlentities (4.3.1)
Author: Paul Battley
Homepage: https://github.com/threedaymonk/htmlentities
Installed at: /var/lib/gems/1.9.2
A module for encoding and decoding (X)HTML entities.
root#bt:~# irb irb(main):001:0> require 'htmlentities' LoadError: no such file to load -- htmlentities
from (irb):1:in `require'
from (irb):1
from /usr/bin/irb:12:in `<main>'
This is the same problem I'm having with nokogiri. I installed the library with
gem install htmlentities
Do you have any idea why I'm having this problem?
Thank you.
EDITED:
I tried also with require 'rubygems' previously to any other require, but happens the same:
I tried require 'rubygems' but is happening the same:
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'htmlentities'
LoadError: no such file to load -- htmlentities
from (irb):2:in `require'
from (irb):2
from /usr/bin/irb:12:in `<main>'
Try to require 'rubygems' before the rest of your gems requirements.
rubygems is actually redefining the Kernel#require method to look for gems on your gempath. Whitout it ruby will just look for local/on path files.
It took me a lot but now I know how to fix it. It's about GEM_PATH.
# echo "export GEM_PATH=/var/lib/gems/1.9.2/" >> ~/.bashrc
# source ~/.bashrc
Now if I run irb:
# irb
irb(main):003:0> require 'htmlentities'
=> true
irb(main):004:0>
WOOT!