加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

部署 – Capistrano编译资产错误 – 资产:预编译:非文化?

发布时间:2020-12-16 19:16:18 所属栏目:百科 来源:网络整理
导读:我的应用程序似乎正在正确部署,但我收到此错误: * executing "cd /home/deploy/tomahawk/releases/20120208222225 bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile" servers: ["ip_address"] [ip_address] executing command
我的应用程序似乎正在正确部署,但我收到此错误:
* executing "cd /home/deploy/tomahawk/releases/20120208222225 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["ip_address"]
    [ip_address] executing command
*** [err :: ip_address] /opt/ruby/bin/ruby /opt/ruby/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets

我在这里试过尝试编译资产的解决方案:http://lassebunk.dk/2011/09/03/getting-your-assets-to-work-when-upgrading-to-rails-3-1/

在这里:http://railsmonkey.net/2011/08/deploying-rails-3-1-applications-with-capistrano/

在这里:http://dev.af83.com/2011/09/30/capistrano-rails-3-1-assets-can-be-tricky.html

这是我的deploy.rb:

require "bundler/capistrano"
load 'deploy/assets'

set :default_environment,{
 'PATH' => "/opt/ruby/bin/:$PATH"
}

set :application,"tomahawk"
set :repository,"repo_goes_here"
set :deploy_to,"/home/deploy/#{application}"
set :rails_env,'production'
set :branch,"master"

set :scm,:git
set :user,"deploy"
set :runner,"deploy"
set :use_sudo,true

role :web,"my_ip"                         
role :app,"my_ip"                        
role :db,"my_ip",:primary => true 

set :normalize_asset_timestamps,false
after "deploy","deploy:cleanup"

namespace :deploy do
    desc "Restarting mod_rails with restart.txt"
    task :restart,:roles => :app,:except => { :no_release => true } do
        run "touch #{current_path}/tmp/restart.txt"
    end

    [:start,:stop].each do |t|
        desc "#{t} task is a no-op with mod_rails"
        task t,:roles => :domain do ; end
    end
end

task :after_update_code do  
run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
end

解决方法

首先不要忘记在下面添加宝石
group :production do
 gem 'therubyracer'
 gem 'execjs'
end

然后在你的cap文件中只需在after_update_code中添加这一行

run "cd #{release_path}; rake assets:precompile RAILS_ENV=production "

这对我来说很好;)

干杯,

Gregory HORION

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读