Fail to install laravel with the latest version composer #5066

Closed
fkoji opened this Issue Mar 15, 2016 · 16 comments

Comments

Projects
None yet
10 participants
@fkoji

fkoji commented Mar 15, 2016

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>]
@Seldaek

This comment has been minimized.

Show comment
Hide comment
@Seldaek

Seldaek Mar 15, 2016

Member

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

Member

Seldaek commented Mar 15, 2016

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

@Seldaek Seldaek closed this Mar 15, 2016

@enriqueplace

This comment has been minimized.

Show comment
Hide comment
@enriqueplace

enriqueplace Mar 15, 2016

Hi, in previous version the installation works fine. IMO is a composer problem.

Hi, in previous version the installation works fine. IMO is a composer problem.

@Seldaek

This comment has been minimized.

Show comment
Hide comment
@Seldaek

Seldaek Mar 15, 2016

Member

Oh I see what the problem is.. as there is no composer.lock file the initial "install" is instead doing an update (as of this afternoon), which triggers the pre-update-cmd, while this was previously triggering pre-install-cmd.

Still an issue with laravel hooks IMO, it shouldn't rely on everything being set up on pre-update-cmd or pre-install-cmd. It just happened to work before but that was kinda luck..

Member

Seldaek commented Mar 15, 2016

Oh I see what the problem is.. as there is no composer.lock file the initial "install" is instead doing an update (as of this afternoon), which triggers the pre-update-cmd, while this was previously triggering pre-install-cmd.

Still an issue with laravel hooks IMO, it shouldn't rely on everything being set up on pre-update-cmd or pre-install-cmd. It just happened to work before but that was kinda luck..

@Seldaek

This comment has been minimized.

Show comment
Hide comment
Member

Seldaek commented Mar 15, 2016

@Nayjest

This comment has been minimized.

Show comment
Hide comment
@Nayjest

Nayjest Mar 15, 2016

@Seldaek

  1. So, will it be default behavior now (not triggering post-install-cmd if there is no composer.lock file)?
    (For me it looks definitely like bug if you are interested in 3rd-party point of view)
  2. Why shouldn't rely on pre-***-cmd ?

Nayjest commented Mar 15, 2016

@Seldaek

  1. So, will it be default behavior now (not triggering post-install-cmd if there is no composer.lock file)?
    (For me it looks definitely like bug if you are interested in 3rd-party point of view)
  2. Why shouldn't rely on pre-***-cmd ?
@Seldaek

This comment has been minimized.

Show comment
Hide comment
@Seldaek

Seldaek Mar 15, 2016

Member
  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.
Member

Seldaek commented Mar 15, 2016

  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.
@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Mar 16, 2016

Contributor

Thanks for the heads up.

Contributor

taylorotwell commented Mar 16, 2016

Thanks for the heads up.

@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Mar 16, 2016

Contributor

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

Contributor

taylorotwell commented Mar 16, 2016

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

@barryvdh

This comment has been minimized.

Show comment
Hide comment
@barryvdh

barryvdh Mar 16, 2016

Contributor

It shouldn't affect most existing installs, because they have a lock file already, so those will still run the pre-install-cmd instead of pre-update-cmd

Contributor

barryvdh commented Mar 16, 2016

It shouldn't affect most existing installs, because they have a lock file already, so those will still run the pre-install-cmd instead of pre-update-cmd

@vlakoff

This comment has been minimized.

Show comment
Hide comment
@vlakoff

vlakoff Mar 16, 2016

Contributor

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".

Contributor

vlakoff commented Mar 16, 2016

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".

@unicodeveloper unicodeveloper referenced this issue in unicodeveloper/laravel-hackathon-starter Mar 16, 2016

Merged

fix(composer): Remove pre-update-cmd #18

@Seldaek

This comment has been minimized.

Show comment
Hide comment
@Seldaek

Seldaek Mar 17, 2016

Member

composer install isn't a fresh install though, it's an installation of pre-defined dependencies stored in a composer.lock file. update is what produces this lock file. Both install and update can result in multiple package install/update/remove operations though, so there's a clear distinction between the command and what happens.

Member

Seldaek commented Mar 17, 2016

composer install isn't a fresh install though, it's an installation of pre-defined dependencies stored in a composer.lock file. update is what produces this lock file. Both install and update can result in multiple package install/update/remove operations though, so there's a clear distinction between the command and what happens.

@Fuxy22

This comment has been minimized.

Show comment
Hide comment
@Fuxy22

Fuxy22 Mar 17, 2016

Wait that makes no sense it's called pre-update-cmd but it's running on install? The pre-update-cmd should be able to assume everything is present because you are not performing an install.

This creates 2 sutiation when pre-update-cmd is run an genuine update and a fresh install that it thinks is an update because the lock file isn't present. I personally think this is a bug.

Fuxy22 commented Mar 17, 2016

Wait that makes no sense it's called pre-update-cmd but it's running on install? The pre-update-cmd should be able to assume everything is present because you are not performing an install.

This creates 2 sutiation when pre-update-cmd is run an genuine update and a fresh install that it thinks is an update because the lock file isn't present. I personally think this is a bug.

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Mar 17, 2016

Contributor

@Fuxy22 would you find it better to have composer install fail entirely if there is no lock file ? this would be the alternative

Contributor

stof commented Mar 17, 2016

@Fuxy22 would you find it better to have composer install fail entirely if there is no lock file ? this would be the alternative

@barryvdh

This comment has been minimized.

Show comment
Hide comment
@barryvdh

barryvdh Mar 17, 2016

Contributor

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

Contributor

barryvdh commented Mar 17, 2016

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

@Fuxy22

This comment has been minimized.

Show comment
Hide comment
@Fuxy22

Fuxy22 Mar 17, 2016

@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.

Fuxy22 commented Mar 17, 2016

@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.

@hungnguyen-kt

This comment has been minimized.

Show comment
Hide comment
@hungnguyen-kt

hungnguyen-kt Mar 23, 2016

Hello @fkoji , you fixed, I same error, please teach for me.

Hello @fkoji , you fixed, I same error, please teach for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment