Ruby on Rails - rake db:migrate produces error: "Rake Aborted! Uninitialized constant Bundler"
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
Do you have bundler
installed?
gem install bundler
And then run bundle
or
bundle install
to install all your dependencies
what about:
gem install bundler
bundle
then retry.
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
精彩评论