Search code examples
phplaravelcomposer-phplaravel-11

Vendor folder not found on Laravel 11


After run composer create-project laravel/laravel:^11.0 project-name then going to my project folder cd project-name after that i should run php artisan serve but i got an error at this step that seems vendor folder not found in my project

Please note: If i using laravel 8 it's work fine but i need to use laravel 11

Help me, Thank!

My php version is 8.2.10

Try to using laravel 11 but can't, On the other hand laravel 8 works find. PLease note that I'am try to run composer install and composer update and remove composer cache

Full error message: "PHP Warning: require(/home/ahmedelmoslmany/Laravel-demo/example-app11/vendor/autoload.php): Failed to open stream: No such file or directory in /home/ahmedelmoslmany/Laravel-demo/example-app11/artisan on line 9 PHP Fatal error: Uncaught Error: Failed opening required '/home/ahmedelmoslmany/Laravel-demo/example-app11/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/ahmedelmoslmany/Laravel-demo/example-app11/artisan:9 Stack trace: #0 {main} thrown in /home/ahmedelmoslmany/Laravel-demo/example-app11/artisan on line 9"


Solution

  • The error:

    Fatal error: Uncaught Error: Failed opening required '/home/ahmedelmoslmany/Laravel-demo/example-app11/vendor/autoload.php'

    says the autoload.php file is missing. This file can be created using the command composer dump-autoload.

    If that does not run successfully you might need to run composer install first.

    I've tried this on a Laravel 11 project where the vendor folder has been deleted and the project can be served successfully after:

    $composer install
    ...
    $composer dump-autoload
    ...
    $php artisan serve
    
     INFO  Server running on [http://127.0.0.1:8000]. 
    

    If your project does not work after running these commands we'll need more information to help fix it.