skip to Main Content

with composer create-project laravel/laravel project-name failing with an error.

Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

PHP Warning:  require(/Documents/project-name/vendor/autoload.php): Failed to open stream: No such file or directory in /Documents/project-name/artisan on line 9

PHP Fatal error:  Uncaught Error: Failed opening required '/Documents/project-name/vendor/autoload.php' (include_path='.:/usr/share/php') in /Documents/project-name/artisan:9

Stack trace:
#0 {main}
  thrown in /Documents/project-name/artisan on line 9

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

enter image description here

I ensured I had permission for user groups and read/write access.

PHP version 8.3

Composer 2.7.4

Ubuntu system and Apache Server configured

2

Answers


  1. Chosen as BEST ANSWER

    Well, I found the problem.

    When executing the composer to create the project, it wasn't able to create the vendor folder even though it had the correct user roles and read/write permissions.

    Then, I did what always worked: I ran the command with sudo, and the vendor folder was created successfully.

    After this success, I realized I didn't install Composer using the same process I always use for server setup.

    So, I followed the instructions https://getcomposer.org, and everything worked.


  2. Make sure your Composer and PHP installations are working correctly. You can check this by running:

    php -v
    composer --version
    

    also double-check filesystem permissions

    sudo chown -R $USER:$USER /Documents
    sudo chmod -R 755 /Documents
    

    also you might try to clear composer cache

    composer clear-cache
    

    In general I would recommend to make sure that composer’s part works well,
    try composer install in that folder or in nested folder

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search