`bin_path' for Gem:Module (NoMethodError)

rails expense /usr/local/bin/rails:19: undefined method `bin_path' for Gem:Module (NoMethodError).

I keep getting the above error after installing rails. I have gone through every step at hivelogic. It worked once and ever since I have been getting the above error.

I understand the issue is that the path is not configured properly.... on typing echo $PATH i get: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin

but when I execute <prompt%>. ~/.bash_login, on typing echo $PATH i get:

/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin

help would be appreciated.

How did you install it?

What do the following commands return:   which gem   which rails   gem env   gem list --local

Hassan Schroeder wrote:

rails expense /usr/local/bin/rails:19: undefined method `bin_path' for Gem:Module (NoMethodError).

I keep getting the above error after installing rails.

How did you install it?

What do the following commands return:   which gem   which rails   gem env   gem list --local

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

Hi Hassan, this is what I have....it seems I have 2 paths for gem paths for which I have no clue how to get rid of.....I have multiple users I don't know if that could be causing the error.....thanks for your help though

unknown0011248da679:~ faisal$ which gem /usr/local/bin/gem unknown0011248da679:~ faisal$ which rails /usr/local/bin/rails unknown0011248da679:~ faisal$ gem env RubyGems Environment:   - RUBYGEMS VERSION: 1.3.1   - RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0]   - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8   - RUBY EXECUTABLE: /usr/local/bin/ruby   - EXECUTABLE DIRECTORY: /usr/local/bin   - RUBYGEMS PLATFORMS:     - ruby     - powerpc-darwin-8   - GEM PATHS:      - /usr/local/lib/ruby/gems/1.8      - /Users/faisal/.gem/ruby/1.8   - GEM CONFIGURATION:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000   - REMOTE SOURCES:      - http://gems.rubyforge.org/ unknown0011248da679:~ faisal$ gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.5) actionpack (2.3.5) activerecord (2.3.5) activeresource (2.3.5) activesupport (2.3.5) capistrano (2.1.0) cgi_multipart_eof_fix (2.5.0) daemons (1.0.9) fastthread (1.0.1) gem_plugin (0.2.3) highline (1.4.0) mongrel (1.1.1) mysql (2.7) needle (1.3.0) net-sftp (1.1.0) net-ssh (1.1.2) rack (1.0.1) rails (2.3.5) rake (0.8.7) rubygems-update (1.3.6) sources (0.0.1) sqlite3-ruby (1.2.1) termios (0.9.4)

Mostly that looks good; the only thing that strikes me right off is the discrepancy between your reported gem version and that of the rubygems-update.

unknown0011248da679:~ faisal$ gem env - RUBYGEMS VERSION: 1.3.1

*** LOCAL GEMS *** rubygems-update (1.3.6)

You might want to try running:

  sudo gem update --system

Hassan Schroeder wrote:

Mostly that looks good; the only thing that strikes me right off is the discrepancy between your reported gem version and that of the rubygems-update.

unknown0011248da679:~ faisal$ gem env �- RUBYGEMS VERSION: 1.3.1

*** LOCAL GEMS *** rubygems-update (1.3.6)

You might want to try running:

  sudo gem update --system

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

k, after running the sudo gem update --system, I did the following....

unknown0011248da679:~ faisal$ gem env RubyGems Environment:   - RUBYGEMS VERSION: 1.3.6   - RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0]   - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8   - RUBY EXECUTABLE: /usr/local/bin/ruby   - EXECUTABLE DIRECTORY: /usr/local/bin   - RUBYGEMS PLATFORMS:     - ruby     - powerpc-darwin-8   - GEM PATHS:      - /usr/local/lib/ruby/gems/1.8      - /Users/faisal/.gem/ruby/1.8   - GEM CONFIGURATION:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000   - REMOTE SOURCES:      - http://rubygems.org/

unknown0011248da679:~ faisal$ gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.5) actionpack (2.3.5) activerecord (2.3.5) activeresource (2.3.5) activesupport (2.3.5) capistrano (2.1.0) cgi_multipart_eof_fix (2.5.0) daemons (1.0.9) fastthread (1.0.1) gem_plugin (0.2.3) highline (1.4.0) mongrel (1.1.1) mysql (2.7) needle (1.3.0) net-sftp (1.1.0) net-ssh (1.1.2) rack (1.0.1) rails (2.3.5) rake (0.8.7) rubygems-update (1.3.6) sources (0.0.1) sqlite3-ruby (1.2.1) termios (0.9.4)

so now Iam able to create rails apps but unable to start server....

I created a rails called example:

unknown0011248da679:~ faisal$ rails example       create       create app/controllers       create app/helpers       create app/models       create app/views/layouts       create config/environments       create config/initializers       create config/locales       create db       create doc       create lib       create lib/tasks       create log       create public/images       create public/javascripts       create public/stylesheets       create script/performance       create test/fixtures       create test/functional       create test/integration       create test/performance       create test/unit       create vendor       create vendor/plugins       create tmp/sessions       create tmp/sockets       create tmp/cache       create tmp/pids       create Rakefile       create README       create app/controllers/application_controller.rb       create app/helpers/application_helper.rb       create config/database.yml       create config/routes.rb       create config/locales/en.yml       create db/seeds.rb       create config/initializers/backtrace_silencers.rb       create config/initializers/inflections.rb       create config/initializers/mime_types.rb       create config/initializers/new_rails_defaults.rb       create config/initializers/session_store.rb       create config/environment.rb       create config/boot.rb       create config/environments/production.rb       create config/environments/development.rb       create config/environments/test.rb       create script/about       create script/console       create script/dbconsole       create script/destroy       create script/generate       create script/runner       create script/server       create script/plugin       create script/performance/benchmarker       create script/performance/profiler       create test/test_helper.rb       create test/performance/browsing_test.rb       create public/404.html       create public/422.html       create public/500.html       create public/index.html       create public/favicon.ico       create public/robots.txt       create public/images/rails.png       create public/javascripts/prototype.js       create public/javascripts/effects.js       create public/javascripts/dragdrop.js       create public/javascripts/controls.js       create public/javascripts/application.js       create doc/README_FOR_APP       create log/server.log       create log/production.log       create log/development.log       create log/test.log

Well it's a major improvement, since atleast this time Iam able to create rails app even after restarting the terminal. Otherwise I had to reload the .bash_login file everytime after starting the terminal.

But now....

unknown0011248da679:~/example faisal$ ls README config lib script vendor Rakefile db log test app doc public tmp unknown0011248da679:~/example faisal$ ruby script/server Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org

I don't understand the above warning , since I have rubygems 1.3.6.

Thanks for your help Hassan.

What's the output of `script/about` ?

Hassan Schroeder wrote:

unknown0011248da679:~/example faisal$ ruby script/server Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org

I don't understand the above warning , since I have rubygems 1.3.6.

What's the output of `script/about` ?

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

this is what I got....

unknown0011248da679:~/example faisal$ ruby script/about Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org unknown0011248da679:~/example faisal$ script/about Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org

Sounds like it's back to a bad path -- somewhere you have more than one `gem` command. Make sure your path is free of duplications, and the directory with the ruby and gem you want is at the front.

And use `find` to track down the extraneous stuff and get rid of it :slight_smile:

Hassan Schroeder wrote:

unknown0011248da679:~/example faisal$ ruby script/about Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org

Sounds like it's back to a bad path -- somewhere you have more than one `gem` command. Make sure your path is free of duplications, and the directory with the ruby and gem you want is at the front.

And use `find` to track down the extraneous stuff and get rid of it :slight_smile:

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

Hi Hassan,

I've checked the paths in both the .bash_login and .bash_profile

.bash_login export PATH=$PATH:/usr/local/bin:/usr/local/mysql/bin:$PATH

.bash_profile export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

On looking at the PATH ...I have "/usr/local/bin" written twice....so Iam thinkin if I should remove the extra "/usr/local/bin".....??? just wanna make sure...thanks Hassan....

That's definitely going to create duplicates, which you don't want, but the critical thing is to make sure you're using the ruby and gem executables you think you are (or at least want to!).

Hassan Schroeder wrote:

I've checked the paths in both the .bash_login and .bash_profile

.bash_login export PATH=$PATH:/usr/local/bin:/usr/local/mysql/bin:$PATH

That's definitely going to create duplicates, which you don't want, but the critical thing is to make sure you're using the ruby and gem executables you think you are (or at least want to!).

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

okay....how do I check the ruby and gem executables exactly...this is what I know...

unknown0011248da679:~ faisal$ ruby -v ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

unknown0011248da679:~ faisal$ gem -v 1.3.6

but I know I have downloaded the ruby 1.8.6...now I dont' exactly know how to check the ones that Iam currently using.....the extraneous ones I mean.....

That's probably the problem right there.

`which ruby` will give you the location of the one currently first in your path. If it's not the one you want, either change your path or get rid of the unwanted version.

And as I said, you can use `find` to look for other versions.