Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing vendor directory can't find files anymore using Symfony 3.4

I'm trying to change the directory of my dependencies on a Symfony 3.4 application.

I need that because I'm working on macOS with Docker and I'd rather have them not shared with the host since the file synchronization is too slow.

The related documentation, says:

The change in the composer.json will look like this:

{
    "config": {
        "bin-dir": "bin",
        "vendor-dir": "/some/dir/vendor"
    },
}

That I did

Then, update the path to the autoload.php file in app/autoload.php:

// app/autoload.php

// ...
$loader = require '/some/dir/vendor/autoload.php';

I don't have any autoload.php file in my app directory.
Am I missing something in the doc ?

The application generates the following fatal error:

Warning: require(/some/dir/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php): failed to open stream: No such file or directory in /vendor/composer/autoload_real.php on line 66

Fatal error: require(): Failed opening required '/some/dir/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php' (include_path='.:/usr/local/lib/php') in /vendor/composer/autoload_real.php on line 66

I originally created the application with:

$ composer create-project symfony/framework-standard-edition test "3.*"
like image 479
Pierre de LESPINAY Avatar asked Mar 07 '23 04:03

Pierre de LESPINAY


1 Answers

  1. Open your composer.json file in editor.
  2. Look for "autoload-dev" section
  3. Remove whole "files" part (if exist)
  4. Save file
  5. Run composer install once again
  6. Enjoy the party.

Sample code:

"autoload-dev": {
    "psr-4": {
      "App\\Tests\\": "tests/"
    },
    "files": [
      "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
    ]
  },
like image 160
Peep Avatar answered Apr 08 '23 14:04

Peep