require(vendor/autoload.php): failed to open stream

前端 未结 16 1352
梦毁少年i
梦毁少年i 2020-11-29 18:02

I know that this issue has been posted many times, but for me it seems to be a different problem.

Indeed, this error

Warning: require(vendor/autol

相关标签:
16条回答
  • 2020-11-29 18:18

    I had this path in my machine:

    C:/xampp5.0/htdocs/project-recordando-symfony/project-recordando-symfony
    

    Then I ran composer install or/and composer update and it returned this error:

    ErrorException ZipArchive::extractTo...
    

    That error is because your path is too much long, I changed to:

    C:/xampp5.0/htdocs/p-symfony/*
    

    and worked!

    0 讨论(0)
  • 2020-11-29 18:18

    Create composer.json file with requisite library for ex:

    {
        "require": {
            "mpdf/mpdf": "^6.1"
        }
    }
    

    Execute the below command where composer.json exists:

    composer install
    

    In case of Drupal :

    Use the web root folder of drupal to include autoload for ex:

    define('DRUPAL_ROOT', getcwd());
    require_once DRUPAL_ROOT . '/vendor/autoload.php';
    

    In case of other systems: Use the root folder variable or location to include the autoload.php

    0 讨论(0)
  • 2020-11-29 18:20

    run composer update. That's it

    0 讨论(0)
  • 2020-11-29 18:27

    In your project folder, the vendor folder is missing so you got this error:

    Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in

    When you download the project through git, the project is downloaded without the vendor folder

    You need /vendor because all your packages are there, including all the classes Laravel uses. The vendor directory contains your Composer dependencies.

    The solution is simple, Just run this command:

    composer update --no-scripts 
    composer update
    
    • composer update --no-scripts It will Skips execution of scripts defined in composer.json file.
    • composer update It will update your depencencies as they are specified in composer.json file.

    With this command, you will re-create the vendor folder in your project and after that your project will start working normally.

    0 讨论(0)
  • 2020-11-29 18:27

    For me Just run this command first

    composer dump-autoload
    

    to add vendor folder.

    then run this command

    composer update --no-scripts
    

    to update composer.

    0 讨论(0)
  • 2020-11-29 18:29

    If you get the error also when you run

    composer install
    

    Just run this command first

    composer dump-autoload
    

    This command will clean up all compiled files and their paths.

    0 讨论(0)
提交回复
热议问题