我最近安装了Rails 3.1,现在我的旧Rails 3.0应用程序不会使用db:migrate。当我尝试运行bundle exec rake db:migrate
时会发生这种情况。我在没有RVM的Ubuntu上
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:142:in `block in cripple_rubygems': can't find executable rake (Gem::Exception)
from /usr/local/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'
当我只运行rake db:migrate
时,它输出:
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.
(See full trace by running task with --trace)
哪个rake
/usr/local/bin/rake
答案 0 :(得分:10)
将它放在您的Gemfile中:
gem 'rake' , '>= 0.9.2'
并运行bundle update
您需要提供有关您正在运行此环境的更多详细信息:
1)尝试运行:
gem list | rake
你得到什么输出?
2)如果在输出中没有看到rake
,请执行以下操作:
gem install rake
然后再次尝试rake db:migrate
3)如果你看到rake,但它仍然不起作用,那么这样做:
which rake
你得到什么输出?看起来应该是这样的:
~/.rvm/gems/ruby-1.9.2-p0/bin/rake