capistrano错误:… / current:没有这样的文件或目录

我正在尝试使用capistrano部署,但是当我进行封顶部署时:更新它不是创建/当前文件夹,这是错误,任何想法?

executing "cd /home/adamtodd/apps/homebase/current && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile --trace" servers: ["xx.xxx.xx.xxx"] [xx.xxx.xx.xxx] executing command ** [out :: xx.xxx.xx.xxx] bash: line 0: cd: /home/adamtodd/apps/homebase/current: No such file or directory 

当我在首次部署时使用Ben Curtis解决方案进行资产预编译( 资产:预编译任务重定义 )时,我遇到了同样的问题(部署:冷没有帮助我)

这里简单的解决方法

 namespace :deploy do namespace :assets do task :precompile, :roles => :web, :except => { :no_release => true } do begin from = source.next_revision(current_revision) # <-- Fail here at first-time deploy because of current/REVISION absence rescue err_no = true end if err_no || capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0 run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} else logger.info "Skipping asset pre-compilation because there were no asset changes" end end end end 

cap deploy:update通常只适用于已经部署过一次的应用程序,因为你没有current目录,所以我假设你的情况没有发生。

尝试进行cap deploy:cold

看起来您已经重新定义了deploy:assets:precompile任务,因为在Capistrano源代码中您可以看到它尝试cd到releases/12345 ,而不是current

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy/assets.rb#L31-43

所以我会检查你的deploy.rb并删除重新定义的任务。

(我已经以同样的方式重新定义了任务,甚至添加了一个像你一样的--trace ,但是我试图解决的任何问题都不再是问题了,开箱即用的任务对我来说很好如果我不得不猜测,我会说我们的自定义任务是将RAILS_GROUPS=assets放入命令字符串,但Capistrano现在自动处理,因为你可以看到你检查链接的源代码。)