Capistrano Rails资产预编译错误

时间:2013-07-31 17:00:23

标签: capistrano asset-pipeline

我有一个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

2 个答案:

答案 0 :(得分: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。

答案 1 :(得分:1)

将此行添加到Capfile

require 'capistrano/bundler'