Ruby on Rails - rake db:migrate 产生错误:“Rake Aborted!未初始化的常量 Bundler”
我是一个全新的 Ruby &导轨程序员。 当我第一次尝试运行 rake 时:
$ rake db:migrate
我收到此错误:
Rake Aborted!
Uninitialized constant Bundler
Looking around here &谷歌搜索,我不知道该怎么办。类似问题的“答案”之一是:“哦,看,ruby 和 rake 安装在不同的 bin 目录中,这就是问题所在。” - 我的情况确实如此,但是解决方案是什么?如何将耙子重新安装到正确的位置? &这能解决我的问题吗?
$ which ruby
/usr/local/bin/ruby
$ which rake
/usr/bin/rake
$ rake db:migrate --trace
(in /Users/jessephillips/src/rails_projects/demo_app)
rake aborted!
Could not find RubyGem bundler (>= 0)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
/Users/jessephillips/src/rails_projects/demo_app/config/boot.rb:2
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/jessephillips/src/rails_projects/demo_app/config/application.rb:1
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/jessephillips/src/rails_projects/demo_app/Rakefile:4
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
I'm a totall new Ruby & Rails programmer.
When I try to run rake for the first time:
$ rake db:migrate
I get this error:
Rake Aborted!
Uninitialized constant Bundler
Looking around here & googling, I don't know what to do. One of the "answers" to a similar question was: "oh, look, ruby & rake are installed in different bin directories, that's the problem." - that's true in my case, but what is the solution? How do I reinstall rake in the right place? & will that fix my issue?
$ which ruby
/usr/local/bin/ruby
$ which rake
/usr/bin/rake
$ rake db:migrate --trace
(in /Users/jessephillips/src/rails_projects/demo_app)
rake aborted!
Could not find RubyGem bundler (>= 0)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
/Users/jessephillips/src/rails_projects/demo_app/config/boot.rb:2
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/jessephillips/src/rails_projects/demo_app/config/application.rb:1
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/jessephillips/src/rails_projects/demo_app/Rakefile:4
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/jessephillips/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否安装了
bundler
?然后运行
bundle
或安装所有依赖项
Do you have
bundler
installed?And then run
bundle
orto install all your dependencies
怎么样:
然后重试。
what about:
then retry.
这不是耙子的问题。这意味着您必须安装捆绑程序。 Bundler 是一个 gem,它打包了所有项目 gem 依赖项(如果您来自 java 背景,可以将其视为 maven,或者 ant)
从这里获取更多信息(http://gembundler.com/),
您首先需要安装bundler运行你的项目。这是一个很好的入门资源
http://railscasts.com/episodes/201-bundler
希望这有助于
欢呼
为Sameera
This is not a problem with rake. This means you have to install bundler. Bundler is a gem which package all your project gem dependencies (Think of it as maven, or ant if you are coming from java background)
get more information from here (http://gembundler.com/)
you first need to install bundler to run your project. here is a good resource to get started
http://railscasts.com/episodes/201-bundler
hope this helps
cheers
sameera