Thursday, November 25, 2010

Capistrano deploy from Windows failing in transfer.rb

I recently ran into an issue with deploying from Windows using Capistrano.  The project I was using had been setup as a multi-staged deployment with Capistrano and had been working quite nicely deploying to my staging and production environments.  Unfortunately, the project sat for a few months and collected some dust while I was busy earning a living.  When I finally got around to working on it again I discovered that capistrano was now failing on the deploy command.  The error I was getting looked liked this:

capistrano/transfer.rb:156
C:/Ruby1.8.7/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:156:in `[]=': undefined method `[]=' fo
r nil:NilClass (NoMethodError)
        from C:/Ruby1.8.7/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:207:in `handle_error'
        from C:/Ruby1.8.7/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:48:in `process!'
        from C:/Ruby1.8.7/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:43:in `loop'

 
Although not completely obvious, the clue to the failure is in the location of the failure.  Failed in capistrano in transfer.rb and it's failing there because tar didn't execute and therefore didn't create the archive file to transfer to the server.


I truly love that when capistrano runs it identifies each command it's going to execute so you can see what it's trying to do.  I'm sure it would have been a much longer trouble shooting session if I had to dig through source to figure that out instead of it just telling me.  When I received that error, knowing that it was working fine a few months ago, it was obvious to me that I had made some changes to my environment that introduced the problem.  As it turns out, I was missing unix utilities in my PATH and in particular I was missing tar.  Once I added a path to my Cygwin/bin folder to my PATH everything started working again. 

Hope this helps someone avoid a few minutes of trouble shooting.

No comments:

Post a Comment