我创建了一个新模型,但是当我运行rake db: migrate
命令时,它会向我发出以下错误:
rake aborted!
Gem::LoadError: You have already activated rake 10.4.0, but your Gemfile requires rake
10.3.2. Prepending `bundle exec` to your command may solve this.
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
我做错了什么?
答案 0 :(得分:3)
使用
bundle exec rake db:migrate
答案 1 :(得分:0)
您还可以通过运行
更新您的宝石bundle update
答案 2 :(得分:0)
执行以下命令
a)删除你的Gemfile.lock文件
b)捆绑安装
它应该使用正确的rake更新Gemfile.lock。
OR
a)gem uninstall rake -v 10.4.0
b)gem install rake -v 10.3.2
然后尝试运行&#39; rake db:migrate&#39;。它应该工作。