2

我有一个 Capistrano 脚本,它将我的应用程序部署到 Amazon EC2 机器上。编译资产时失败:

* executing "cd -- /home/ec2-user/uc_social_server/releases/20130731161645 && RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile"
    servers: ["ec2-23-22-188-11.compute-1.amazonaws.com"]
    [ec2-23-22-188-11.compute-1.amazonaws.com] executing command
 ** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] Could not find thread_safe-0.1.0 in any of the sources
 ** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] 
 ** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] Run `bundle install` to install missing gems.
 ** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] 
    command finished in 591ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/ec2-user/uc_social_server/releases/20130731161645; true"
    servers: ["ec2-23-22-188-11.compute-1.amazonaws.com"]
    [ec2-23-22-188-11.compute-1.amazonaws.com] executing command
    command finished in 201ms
failed: "sh -c 'cd -- /home/ec2-user/uc_social_server/releases/20130731161645 && RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile'" on ec2-23-22-188-11.compute-1.amazonaws.com
4

2 回答 2

2

将以下内容添加到 deploy.rb

require "bundler/capistrano"
require "rvm/capistrano"
before "deploy:assets:precompile", "bundle:install"

并跟随 Capfile

load 'deploy/assets'

并跟随 Gemfile

gem 'rvm-capistrano'

为我解决了这个问题。如果您不使用 rvm,也许您不需要 rvm/capistrano 或 rvm-capistrano gem。

于 2013-07-31T17:00:22.777 回答
1

将此行添加到您的Capfile

require 'capistrano/bundler'
于 2014-03-23T20:24:11.300 回答