Dan Rubio
Dan Rubio

Reputation: 4907

Capistrano how to resolve cannot overwrite directory '/var/local/app/current' with non-directory?

I am troubleshooting the error in the above title. I understand what is happening but while trying to trouble shoot this error, I've come across an interesting Github Issue with the solution. However, I don't understand the solution.

Here is the link Github Capistrano Issue

Basically, one user reports that the way to solve this issue is to implement the following:

Just make sure any directory that Capistrano is going to try to symlink to doesn't exist as a physical directory. That should probably also go for any file or directory you added to the :linked_files or :linked_dirs config option.

My question is simple. What does this user mean when he says to make sure the directory is not physical?

Upvotes: 4

Views: 2142

Answers (3)

TomDogg
TomDogg

Reputation: 3935

This error is thrown because the directory in question (in your case /var/local/app/current) already exists when Capistrano is trying to handle it.

It most certainly exists already because of your previous deployment failed and left parts of it behind.

The solution is to simply delete the directory /var/local/app/current and then deploy again.

Upvotes: -1

zykadelic
zykadelic

Reputation: 1159

I ran into the same issue running Capistrano 3.11.0, together with capistrano-maintenance 1.2.0. I managed to resolve it by, after a failed deploy, deleting the mysite/current directory and running ln -s mysite/releases/VERSION mysite/current and redeploying.

Upvotes: 5

Brett Allred
Brett Allred

Reputation: 3487

Can you post more information about your setup. One thing to try is to blow away all contents in your /var/www/app directory and then re-deploy. That is how I solved it. There were some existing directories from previous solutions that were interfering .

Upvotes: 0

Related Questions