未初始化的常量Object :: Bundler

时间:2011-12-09 13:55:25

标签: ruby-on-rails ruby bundle

我对rails很新。我是一名mac book pro

我从git中删除了poi repo但是无法运行任何东西。 包括

rails -s 
rake routes
rake db:migrate
bundle install
rake test
bundle update

我不确定我缺少什么

Projects$ git clone https://github.com/tekpub/poi.git poi
Cloning into poi...
remote: Counting objects: 356, done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 356 (delta 91), reused 356 (delta 91)
Receiving objects: 100% (356/356), 199.57 KiB, done.
Resolving deltas: 100% (91/91), done.
Projects$ cd poi 
poi$ bundle install
/Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [Selenium-1.1.14, daemons-1.1.4, eventmachine-0.12.10, js_spec-0.3.3, rack-1.3.5, rake-0.9.2, thin-0.8.1] (Gem::LoadError)
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/bundle:18:in `<main>'

poi$ rake routes
rake aborted!
uninitialized constant Object::Bundler

(See full trace by running task with --trace)
poi$ 

poi$ 

感谢

=================

修改

poi$ sudo gem install bundler
Password:
Successfully installed bundler-1.0.21
1 gem installed
Installing ri documentation for bundler-1.0.21...
Installing RDoc documentation for bundler-1.0.21...
poi$ rails routes
/Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [Selenium-1.1.14, daemons-1.1.4, eventmachine-0.12.10, js_spec-0.3.3, rack-1.3.5, rake-0.9.2, thin-0.8.1] (Gem::LoadError)
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
    from /Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/rails:18:in `<main>'
poi$ 

=================

编辑2

运行rvmsudo gem install bundler后仍然会收到相同的错误

poi$ rvmsudo gem install bundler
Password:
Successfully installed bundler-1.0.21
1 gem installed
Installing ri documentation for bundler-1.0.21...
Installing RDoc documentation for bundler-1.0.21...
poi$ rake routes
/Library/Ruby/Site/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rake (>= 0) amongst [bundler-1.0.21] (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:in `to_spec'
    from /Library/Ruby/Site/1.8/rubygems.rb:1210:in `gem'
    from /usr/bin/rake:18
poi$ 

===========

编辑3

我很喜欢这个并且仍然遇到同样的问题

'sudo gem install rake' 
Successfully installed rake-0.9.2.2 1 gem installed 
poi$ rake -v 
rake aborted! uninitialized constant Object::Bundler

3 个答案:

答案 0 :(得分:3)

不要以root用户身份安装你的宝石。

来自RVM instructions on gems

  

不要使用sudo ......

     

使用RVM宝石。当你做sudo时,你正在运行命令   root,另一个shell中的另一个用户,因此所有的设置   当命令在sudo下运行时,RVM已为您完成的操作被忽略   (例如GEM_HOME等......)。所以,请尽快重申   'sudo'你作为root系统用户运行,它将清除   您的环境以及它创建的任何文件都不可能   由您的用户修改,将导致奇怪的事情发生。   (你会开始认为有人有你的巫毒娃娃   应用...)

只需gem install [gem],看看效果如何。

答案 1 :(得分:0)

看起来没有安装Bundler gem。运行gem install bundler,然后重试解压缩Rails应用程序。

答案 2 :(得分:0)

这个过程应该只是

gem install bundler
bundle install

这应该是你所需要的一切。