包更新耙不是固定我“你已经激活耙...”错误(bundle update rake not fixi

2019-10-29 20:20发布

当我运行rake db:migrate在Ubuntu终端我不断收到错误:

rake aborted!
You have already activated rake 10.0.4, but your Gemfile requires rake 0.9.6. Using bundle exec may solve this.

我看到计算器来解决这个问题的方法是运行:

bundle update rake

所以,我这样做,我得到:

Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Enter your password to install the bundled RubyGems to your system: 
Using rake (0.9.6) 
Using SystemTimer (1.2.3) 
etc...
etc...

    Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

这难道不应该更新耙10.0.4? 因为当我运行rake db:migrate我仍然得到错误:

rake aborted!
You have already activated rake 10.0.4, but your Gemfile requires rake 0.9.6. Using bundle exec may solve this.

任何想法我怎么能解决这个问题? 当我运行gem env我得到:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.8
     - /home/mycompaq/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

莫不是创业板PATHS一些冲突? 谢谢你的帮助。

Answer 1:

我总是建议之前,任何此类命令使用“捆绑EXEC”

bundle exec rake db:migrate


Answer 2:

您已为问题与rvm -所以我假设你使用RVM,但是你的宝石ENV看起来并不像你所用RVM安装红宝石,做到这一点,你需要运行:

rvm use ruby --version
bundle install

RVM默认自带rubygems-bundler宝石,将自动进行bundle exec对你那么它应该是足够的:

rake db:migrate

用RVM安装红宝石之后,做出的运行下一届会议的红宝石默认:

rvm use ruby --default

在极少数情况下(如系统安装或OSX),您需要重新启动计算机,这才会生效。



文章来源: bundle update rake not fixing my 'You have already activated rake…' error