开发者

Ruby refuses to acknowledge that I've installed Rubygems... Why?

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/rubygem开发者_如何学Pythons/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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜