开发者

No rails commands will run

I am trying to learn rails and haven't used it in the last few weeks but today when I try to run any rails commands such as - 'rails -v' - 'script/server'

I get not have reinstalled ruby but the didn't don't have a clue what could be wrong Am on a brand new Macbook Pro

Jeremy-Geross-MacBook-Pro:~ Jeremy$ rails -v

/Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `merge': can't convert String into Hash (TypeError)
 from /Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `initialize'
 from /Library/Ruby/Site/1.8/rubygems.rb:384:in `new'
 from /Library/Ruby/Site/1.8/rubygems.rb:384:in `configuration'
 from /Library/Ruby/Site/1.8/rubygems.rb:634:in `path'
 from /Library/Ruby/Site/1.8/rubygems/source_index.rb:68:in `installed_spec_directories'
 from /Library/Ruby/Site/1.8/rubygems/source_index.rb:58:in `from_installed_gems'
 from /Library/Ruby/Site/1.8/rubygems.rb:881:in `source_index'
 from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
 from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:13:in `initialize'
 from /Library/Ruby/Site/1.8/rubygems.rb:839:in `new'
 from /Library/Ruby/Site/1.8/rubygems.rb:839:in `searcher'
 from /Library/Ruby/Site/1.8/rubygems.rb:838:in `synchronize'
 from /Library/Ruby/Site/1.8/rubygems.rb:838:in `searcher'
 from /Library/Ruby/Site/1.8/rubygems.rb:478:in `find_files'
 from /Library/Ruby/Site/1.8/rubygems.rb:1103
 from /usr/bin/rails:9:in `require'
 from /usr/bin/rails:9

Update:

whereis ruby: /usr/bin/ruby

ruby -v : ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.3.0]

whereis gem : /usr/bin/gem

gem -v : `

/Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `merge': can't convert String into Hash (TypeError)
    from /Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `initialize'
    from /Library/Ruby/Site/1.8/rubygems.rb:384:in `new'
    from /Library/Ruby/Site/1.8/rubygems.rb:384:in `configuration'
    from /Library/Ruby/Site/1.8/rubygems.rb:634:in `path'
    from /Library/Ruby/Site/1.8/rubygems/source_index.rb:68:in `installed_spec_directories'
    from /Library/Ruby/Site/1.8/rubygems/source_index.rb:58:in `from_installed_gems'
    from /Library/Ruby/Site/1.8/rubygems.rb:881:in `source_index'
    from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
    from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:13:in `initialize'
    from /Library/Ruby/Site/1.8/rubygems.rb:839:in `new'
    from /Library/Ruby/Site/1.8/rubygems.rb:839:in `searcher'
    from /Library/Ruby/Site/1.8/rubygems.rb:838:in `synchronize'
    from /Library/Ruby/Site/1.8/rubygems.rb:838:in `searcher'
    from /Library/Ruby/Site/1.8/rubygems.rb:478:in `find_files'
    from /Library/Ruby/Site/1.8/rubygems.rb:1103
    from /usr/bin/gem:8:in `require'
    from /usr/bin/gem:8

gem list :

/Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `merge': can't convert String into Hash (TypeError)
    from /Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in `initialize'
    from /Library/Ruby/Site/1.8/rubygems.rb:384:in `new'
    from /Library/Ruby/Site/1.8/rubygems.rb:384:in `configuration'
    from /Library/Ruby/Site/1.8/rubygems.rb:634:in `path'
    from /Library/Ruby/Site/1.8/rubygems/source_index.rb:68:in `installed_spec_directories'
    from /Library/Ruby/Site/1.8/rubygems/source_index.rb:58:in `from_installed_gems'
    from /Library/Ruby/Site开发者_运维问答/1.8/rubygems.rb:881:in `source_index'
    from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
    from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:13:in `initialize'
    from /Library/Ruby/Site/1.8/rubygems.rb:839:in `new'
    from /Library/Ruby/Site/1.8/rubygems.rb:839:in `searcher'
    from /Library/Ruby/Site/1.8/rubygems.rb:838:in `synchronize'
    from /Library/Ruby/Site/1.8/rubygems.rb:838:in `searcher'
    from /Library/Ruby/Site/1.8/rubygems.rb:478:in `find_files'
    from /Library/Ruby/Site/1.8/rubygems.rb:1103
    from /usr/bin/gem:8:in `require'
    from /usr/bin/gem:8

`

whereis rails : /usr/bin/rails


Looks like your gemrc file could be broken. You could just delete that file (or better move it away) and have a look at the contents. It should be in the form key: value per line, or key: followed by some indented lines.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜