15

During my rails(3.2.16v) deploy with capistrano v3 I am getting the following error.

$cap development deploy --trace

DEBUG [014a40e4] Running /usr/bin/env [ -L /home/ec2-user/capistrano-3/my_app/releases/20140117124107/public/assets ] on 50.13.220.55
DEBUG [014a40e4] Command: [ -L /home/ec2-user/capistrano-3/my_app/releases/20140117124107/public/assets ]
DEBUG [014a40e4] Finished in 0.602 seconds with exit status 1 (failed).
DEBUG [9c5901ab] Running /usr/bin/env [ -d /home/ec2-user/capistrano-3/my_app/releases/20140117124107/public/assets ] on 50.13.220.55
DEBUG [9c5901ab] Command: [ -d /home/ec2-user/capistrano-3/my_app/releases/20140117124107/public/assets ]
DEBUG [9c5901ab] Finished in 0.639 seconds with exit status 1 (failed).

//// this error is at the end of the trace

** Invoke deploy:assets:backup_manifest (first_time)

** Execute deploy:assets:backup_manifest

DEBUG [a08f4c02]    cp: 
DEBUG [a08f4c02]    cannot stat `/home/ec2-user/capistrano-3/my_app/releases/20140117064709/public/assets/manifest*'
DEBUG [a08f4c02]    : No such file or directory
DEBUG [a08f4c02]    
cap aborted!
cp stdout: Nothing written
cp stderr: Nothing written

Tasks: TOP => deploy:assets:backup_manifest
The deploy has failed with an error: #<SSHKit::Command::Failed: cp stdout: Nothing written
cp stderr: Nothing written
>
** Invoke deploy:failed (first_time)
** Execute deploy:failed

I don't have any assets folder in my local machine too. Can any body help me??

user3205523
  • 283
  • 3
  • 8

4 Answers4

20

This happens with sprockets 3.0.x and capistrano-rails, and seems fixed with capistrano-rails 1.1.3.

If your Gemfile has gem 'capistrano-rails', '~> 1.1' (as recommended in the installation guide), just type bundle update capistrano-rails to upgrade.

See https://github.com/capistrano/rails/blob/master/CHANGELOG.md#113-apr-18-2015 or https://github.com/capistrano/rails/issues/111

linesarefuzzy
  • 1,890
  • 17
  • 17
a2ikm
  • 455
  • 5
  • 8
14

Try:

touch /home/ec2-user/capistrano-3/my_app/releases/20140117064709/public/assets/manifest

I think a previous cap <env> deploy that was misconfigured has gummed up the works, and now your forever doomed. Simply touching a manifest file, will allow the task deploy:assets:backup_manifest to keep on doing its thing, since it expects the previous builds manifest file to be there to clean up. So, give it something to clean. Anyways, this solved my problem.

tl;dr; Make trash, keep littering, someone, somewhere will clean up after you, in this case one previous precompile's trash is assets_manifest_backup's treasure.

I had also ssh'ed to server, ensured that RAILS_ENV=production bundle worked just fine, and had to resolve some ssh deploy keys for a private git repo. That could have been the gum, gumming up my works.

Peter Dietz
  • 2,599
  • 1
  • 24
  • 23
  • 1
    Having the same error, it sufficed to `$ mkdir public/assets && touch public/assets/manifest` => `$ cap deploy` => hurray. thanks peter – The F Apr 14 '15 at 13:17
5

Add to Gemfile gem 'sprockets', '2.12.3'

MZaragoza
  • 10,108
  • 9
  • 71
  • 116
  • Why is this downvoted? This solution works for me. See https://github.com/capistrano/rails/issues/111. This issue is caused by sprocket 3 using .sprocket-manifest[blablabla] instead of .manifest[blablabla] – Taufiq Muhammadi Apr 14 '15 at 22:44
0

Are you precompiling your assets ? maybe it will help to precompile your assets before deployng.

mmenafra
  • 110
  • 5