简体   繁体   English

rake db:migrate的迁移错误

[英]migration error with rake db:migrate

I created a new model, but when I run the rake db: migrate command, it shoots me the following error: 我创建了一个新模型,但是当我运行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)

What am I doing wrong? 我究竟做错了什么?

采用

bundle exec rake db:migrate

您还可以通过运行更新您的宝石

bundle update

Execute the below commands 执行以下命令

a) delete your Gemfile.lock file a)删除您的Gemfile.lock文件

b)bundle install b)捆绑安装

It should update Gemfile.lock with correct rake. 它应该使用正确的rake更新Gemfile.lock。

OR 要么

a) gem uninstall rake -v 10.4.0 a)gem uninstall rake -v 10.4.0

b) gem install rake -v 10.3.2 b)gem install rake -v 10.3.2


then try running 'rake db:migrate'. 然后尝试运行'rake db:migrate'。 it should work. 它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM