4

我正在使用 MySQL Server 5.7(64 位)、MySQL 连接器 C 6.1 6.1.2(32 位)、Ruby 1.9.3p392(2013-02-)在 Windows 7(64 位)上通过 Lynda.com 完成教程 Ruby on Rails 3 Essential Training 22) [i386-mingw32] 和 Rails 3.2.12。

在培训中,我在“数据库和迁移”部分尝试将我在 MySQL 中创建的数据库与我的 Rails 项目同步,但是我遇到了中止消息。

讲师要求我的班级通过命令提示符打开我们的 rails 项目并执行 Rake 以使用以下代码构建“schema.rb”:

这就是我现在运行“db:schema:dump”时所说的

C:\Sites\todo>rake db:schema:dump rake aborted!

You have already activated rake 10.1.1, but your Gemfile requires rake 10.0.3.

Using bundle exec may solve this.

C:/Sites/todo/config/boot.rb:6:in'`

C:/Sites/todo/config/application.rb:1:in'`

C:/Sites/todo/Rakefile:4:in'`

(See full trace by running task with --trace)

我该怎么做才能获得 Gemfile 所需的 rake?

4

2 回答 2

5

如此活跃的 gem 版本 10.1.1,但你的项目有依赖 10.0.3

解决只是使用bundle exec之前 rake db:schema:dump

bundle exec rake db:schema:dump

由于您在 Gemfile 有旧版本,您可以执行gem uninstall rake, bundle install,这将安装正确版本的rake.

于 2013-12-23T20:51:30.853 回答
1

为了解决这个问题,我决定从我的电脑上删除 Windows 并下载一个名为 Ubuntu 的 Linux 发行版。通过改变我所处的编程环境,这完全绕过了这个问题,从而在适合在 Ruby 中执行的编程环境中加速了我。我不必在新电脑上花任何钱,但我确实浪费了大约 3 个月的时间等待得到这个问题的答案。

于 2014-04-08T01:13:39.707 回答