Search code examples
symfonydeploymentservercomposer-phpcapistrano

Symfony deploy with capistrano throw "The target directory "web" does not exist." on assets install


I have a symfony system that i`m trying to deploy to with capistrano. The connection is through ssh.

The function that throws the error is symfony:assets:install as it looks below:

php /var/www/xx/releases/20200415083534/app/console assets:install web --symlink

It is throwing the following error

[InvalidArgumentException]                  
  The target directory "web" does not exist. 

As you would expect the folder is right there - my user is the owner and have rights for it. If I go to this exact folder /20200415083534 and run the same script as above it does install the assets as expected.

The composer extra looks like so:

"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": [
      {
        "file": "app/config/parameters.yml"
      },
      {
        "file": "app/config/parameters_prod.yml",
        "dist-file": "app/config/parameters_prod.yml.dist"
      }
    ],
    "branch-alias": {
      "dev-master": "2.8.*"
    }
  }

Any ideas?

P.S. I have checked this one "assets:install" command fails with error "The target directory "web" does not exist", why? as it has the same error, but the situation is different and his solution doesn't work for my case.


Solution

  • It may sound a bit stupid, but I did resolved the issue by adding a space in the console app path in deploy.rb file. ( I think the issue is somewhere else, but that workaround did it in my case ) It looks like:

    set :symfony_console_path, " app/console"
    

    now.

    This has changed the command line to:

    php /var/www/xx/releases/20200415083534/ app/console assets:install web --symlink
    

    Which does actually execute as expected.

    Hope this helps someone banging his head on that issue (just as I did for a few days).