deployer: Error: Failed to open stream: No such file or directory when using third party recipe

  • Deployer version: 7.1
  • Deployment OS: OSX
<?php
namespace Deployer;

require_once 'recipe/symfony.php';
require_once 'recipe/setono_dotenv.php';

...

My composer.json looks like this:

{
    "license": "proprietary",
    "type": "project",
    "require": {
        "php": ">=8.1",
        "deployer/deployer": "^7.1",
        "setono/deployer-dotenv": "2.x-dev"
    },
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": false,
            "ergebnis/composer-normalize": true
        }
    }
}

I get this error:

➜  deployment git:(master) ✗ vendor/bin/dep deploy
 ErrorException  in deploy.php on line 10:

  require_once(recipe/setono_dotenv.php): Failed to open stream: No such file or directory

This worked in v6 and I suspect there has been some work in how the include path is used? What is way to allow me and others to create third party recipes nowadays?

Thanks for a great tool ❤️

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 16 (4 by maintainers)

Most upvoted comments

It must be these lines that are the culprit: https://github.com/deployphp/deployer/blob/master/bin/dep#L50-L54.

Is there a reason for this ordering? If the ordering was:

$autoload = [
    __DIR__ . '/../../../autoload.php', // The dep located at "vendor/deployer/deployer/bin".
    __DIR__ . '/../vendor/autoload.php', // The dep located at "deployer.phar/bin" or in development.
    __DIR__ . '/../autoload.php', // The dep located at "vendor/bin".
];

it would load the correct autoloader.