composer: Fail to install laravel with the latest version composer

I failed to install laravel with the latest version composer, but success to do with 1.0.0-alpha11 1.0.0-beta1.

$ php composer.phar create-project --prefer-dist laravel/laravel blog
Installing laravel/laravel (v5.2.15)
  - Installing laravel/laravel (v5.2.15)
    Loading from cache

Created project in blog
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
PHP Warning:  require(/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/laraveltest/blog/bootstrap/autoload.php on line 17
PHP Fatal error:  require(): Failed opening required '/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/vagrant/laraveltest/blog/bootstrap/autoload.php on line 17
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error


  [RuntimeException]                                                                                                                                                                      
  Error Output: PHP Warning:  require(/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/laraveltest/bl  
  og/bootstrap/autoload.php on line 17                                                                                                                                                    
  PHP Fatal error:  require(): Failed opening required '/home/vagrant/laraveltest/blog/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/vagr  
  ant/laraveltest/blog/bootstrap/autoload.php on line 17                                                                                                                                  


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 8
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Though I will note this is going to break a shit load of sites and cause me a support nightmare 😬 👼

This is a configuration issue in laravel IMO, not a composer issue, please report it there.

An sort-of workaround would be to allow commands to soft-fail, without stopping the entire process. "pre-install-cmd": ["@php artisan clear-compiled"]

  1. Before, running install without a lock file did an install that was almost an update, but still ran the pre/post-install-cmd scripts. Now we normalized it to actually run an update and fire pre/post-update-cmd, because that’s what it is doing. If you have a lock file though it will run install as before.
  2. pre-***-cmd you can rely on them, but you can not assume that the autoload.php and so on will be present, as on the first install they won’t be.

@stof keep the previous way it worked.

Also why is it running on composer create-project that’s clearly not a update but the creation of a new project. It may be doing a update under the hood but exposing that to the user by triggering the hooks doesn’t seem right.

Especially since the manual only says:

pre-update-cmd: occurs before the update command is executed

It doesn’t say anywhere it occurs on composer install or composer create-project.

As I understand it these hooks are linked to the commands and not to the thing these commands do under the hood that’s why the previous behaviour made more sense.

I would give it a different name if I wanted to expose hooks to the underlying logic since everyone is already relying on the current hooks to work as the always did.

From a user point of view, running composer install sounds like it involves installing and nothing else, whether there is a lock file or not.

Indeed, when there is no lock file an “update” has be done beforehand, but for the user it just sounds like “fresh install”.