Failed opening required '.../vendor/autoload.php'

I was trying to do a composer install and got this error:

PHP Fatal error:  require(): Failed opening required 'my_path/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /my_path/bootstrap/autoload.php on line 17  

This is happening because Composer changed in march the way pre-update-cmd works. As there is no composer.lock file, the initial "install" is instead doing an update, which triggers the pre-update-cmd, while this was previously triggering the pre-install-cmd.

This can be fixed by moving the php artisan clear-compiled from pre-update-cmd to post-update-cmd. First remove these lines:

"pre-update-cmd": [
    "php artisan clear-compiled"
]

Then add the php artisan clear-compiled to the post-update-cmd:

"post-update-cmd": [
    "php artisan clear-compiled",
    "php artisan optimize"
]

See the complete changelog here.