【问题标题】:Capistrano + RVM + Rake taskCapistrano + RVM + Rake 任务
【发布时间】:2011-10-06 17:19:22
【问题描述】:

我有一个项目

  1. 使用 rvm ruby​​ 1.9.2(在项目目录的 .rvmrc 中设置)。
  2. 使用 capistrano 进行部署。
  3. 有一个 rake 任务,我想通过 capistrano 从本地计算机远程运行。

我创建了一个 .sh 文件来运行我的任务:

cd /var/www/pluslook/current
/home/kirill/.rvm/scripts/rvm use 1.9.2@pluslook
/home/kirill/.rvm/gems/ruby-1.9.2-p180@pluslook/bin/rake parse:feed RAILS_ENV="production" --trace

但是当我尝试运行这个任务时,我遇到了一个错误:

Using /home/kirill/.rvm/gems/ruby-1.9.2-p180 with gemset pluslook
Could not find linecache19-0.5.12 in any of the sources
Run `bundle install` to install missing gems.

我已将所有 gem 安装在项目的当前目录中,因此看起来 rake 任务正在从另一个目录运行。当我尝试从 capistrano 运行任务时,它显示了同样的错误。

谢谢你,对不起我的英语:)

【问题讨论】:

  • which bundle 输出什么?
  • Dogbert 它的 /usr/local/bin/bundle

标签: ruby rake rvm capistrano


【解决方案1】:
  1. 你在 config/deploy.rb 中有 'require "bundler/capistrano"'
  2. 您是否在提交最新的代码更改之前运行了“捆绑安装”?

【讨论】:

  • 当然。当从我的“当前”目录运行“捆绑安装”时,一切正常:您的捆绑已完成!使用 bundle show [gemname] 查看捆绑 gem 的安装位置。
  • 你在 repo 中有最新的 Gemfile.lock 吗?你用的是什么版本的 Bundler?
  • 是的,我有 Gemfile.lock 并且捆绑程序版本是 1.0.15。如果我在 /current 目录中,它可以工作,但是当我尝试从远程机器运行 rake 时出现错误。
  • 这是 ruby​​gems 特定版本的错误。你有什么 ruby​​gems 版本?我们中的许多人都有一些问题,而 ruby​​gems 降级解决了这些问题。你能试试this吗?
  • 您在服务器上使用 RVM 吗?如果是这样,请根据documentation 检查您的配置。需要“rvm/capistrano”,设置:rvm_ruby_string,'ruby-1.9.2-p180@pluslook'
猜你喜欢
  • 2023-04-07
  • 1970-01-01
  • 1970-01-01
  • 2015-04-15
  • 2010-09-23
  • 2015-08-19
  • 2020-01-17
  • 1970-01-01
  • 2012-04-20
相关资源
最近更新 更多