“即使使用bundle exec,您已经激活了”消息

时间:2013-07-03 04:39:40

标签: ruby-on-rails gem rvm capistrano bundler

我在共享路径中的Gemfile中安装gems,默认情况下是Capistrano,当我运行时:

bundle exec rake assets:precompile RAILS_ENV=production

我明白了:

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

看到:

cat Gemfile.lock | grep rake

返回:

  rake (>= 0.8.7)
rake (10.0.4)

这是我的gem environment输出:

  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/bitnami/my_app/shared/bundle/ruby/1.9.1/
  - RUBY EXECUTABLE: /opt/bitnami/ruby/bin/ruby
  - EXECUTABLE DIRECTORY: /home/bitnami/my_app/shared/bundle/ruby/1.9.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/bitnami/my_app/shared/bundle/ruby/1.9.1/
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gemhome" => "/home/bitnami/my_app/shared/bundle/ruby/1.9.1/"
     - "gempath" => ["/home/bitnami/my_app/shared/bundle/ruby/1.9.1/"]
  - REMOTE SOURCES:
     - http://rubygems.org/

更新

which -a rake
/opt/bitnami/rvm/bin/rake
/opt/bitnami/ruby/bin/rake

更新2

我试过给rake提供完整的路径,但同样的问题

更新3

重新安装RVM后

  * WARNING: Found gemhome in /home/bitnami/.gemrc, please remove it, as it will break rubygems in RVM.
  * WARNING: Found gempath in /home/bitnami/.gemrc, please remove it, as it will break rubygems in RVM.
    If it is intended or a mistake 'export rvm_ignore_gemrc_issues=1' to avoid this warning.

我现在该怎么办?我在那里添加了gem_home,因为我希望将我的宝石安装在我想要的目录中,不确定这是否正确。

1 个答案:

答案 0 :(得分:1)

你需要按照说明操作,如果安装程序告知有不兼容的设置,那么你需要清除它们,通常这应该没问题:

rm -f ~/.gemrc

一个常见的解决方案也是禁用文档(服务器上不需要,而且无论如何也没有多少用户在本地使用它们):

echo 'gem: --no-ri --no-rdoc' > ~/.gemrc

两者都将摆脱强制~/.gemrc / gemhome的旧gempath - 这是必需的,因为这些变量通过环境变量GEM_HOME / {与RVM控制{1}}。

修复GEM_PATH后运行:

~/.gemrc

它将确保安装ruby,设置为默认值并正确加载到当前环境中。