Skip to content

Updating appstarter with composer does not take composer.phar into account #1932

Description

@Tilogorn

When you use composer via composer.phar (see installation instructions) you get an error during composer update due to a "wrong" post-update-cmd in composer.json because you didn't install composer as a globally available binary/script.

Steps to reproduce

$ php composer.phar create-project codeigniter4/appstarter -s beta --no-dev
Installing codeigniter4/appstarter (v4.0.0-beta.2)
[...]
$ cd appstarter
$ php ../composer.phar update --no-dev
Loading composer repositories with package information
Updating dependencies
Generating autoload files
> composer dump-autoload
sh: 1: composer: not found
Script composer dump-autoload handling the post-update-cmd event returned with error code 127

The line producing the error in composer.json is:

{
    ...
    "scripts": {
        "post-update-cmd": [
            "composer dump-autoload"
        ]
    },
    ...
}

Changing this line to php ../composer.phar dump-autoload leads to a successful update in my use-case (composer.phar above project root).

I don't know how to resolve this. Maybe composer has information on how it was started? Or there is a more generic way to call composer in composer.json.

While writing this issue, I found a solution: I found this. Replacing composer with @composer works in my test case. Has to be tested with a regular, global composer installation.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions