【问题标题】:RoR rake bundle dependenciesRoR rake 捆绑包依赖项
【发布时间】:2013-02-07 12:15:20
【问题描述】:

平台:Windows 7,在 JRuby 1.6.8 上运行。

C:\project> rake db:migrate
rake aborted!
You have already activated rake 10.0.3, but your Gemfile requires rake 0.9.2.2.
Using bundle exec may solve this.

好的。我已经添加了

gem "rake", "= 0.9.2.2"

到 Gemfile 并运行:

C:\project> bundle exec rake db:migrate
bundler: command not found: rake
Install missing gem executables with `bundle install`

WTF?

我也做过

bundle install --deployment

无济于事。

我安装了不同版本的 rake:

C:\project>gem list

LOCAL GEMS
...
rake (10.0.3, 0.9.2.2, 0.8.7)

如何解决这个问题?我需要 rake db:migrate 与我的特定(继承的)RoR 项目一起使用往往有点过时的 gem,但它们都在 Gemfile 中指定。

【问题讨论】:

    标签: ruby-on-rails gem rake bundle


    【解决方案1】:
    1. 在您清楚了解它的用途之前,请勿运行 bundle --deployment。 (比较混乱,我们一般用bundle install --path vendor/bundle

    2. 第一个错误意味着你应该使用bundle exec执行你的命令,比如bundle exec rake db:migrate

    3. Gemfile 中的版本更改后,您应该只运行bundle install 而没有--deployment

    此时我建议您删除项目主页中的 .bundle 文件夹,这将反转 --deployment 调用。之后拨打bundle install 再试一次。如果它不起作用,请告诉我们。

    不要沮丧,一旦你掌握了它的窍门,捆绑包就很酷。

    【讨论】:

    • 但这还不够:似乎较新的 activerecord 版本是个问题,我必须按照您写的操作并卸载较新的 activerecord gem。谢谢!!
    • 如果我和Passenger有问题怎么办?根据this,我应该使用--deployment。但是在我使用它之后 - 我有错误“你已经激活了 rake 10.0.3”。我什至在我的宝石列表中都没有这个版本!但它出现了。
    • @TiSer 抱歉,我没有足够的信息(您链接的帖子已经快两年了)。尝试创建一个新问题并指定更多详细信息。
    猜你喜欢
    • 2015-10-04
    • 2015-03-12
    • 2015-12-14
    • 2015-12-03
    • 2017-09-10
    • 2014-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多