Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tilogorn opened this issue Apr 10, 2019 · 1 comment
Closed

Comments

@Tilogorn
Copy link

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.

@jim-parry
Copy link
Contributor

Your description does not sound like globally installed composer, which would then be accessible as "composer" or "php composer.phar" anywhere. It sounds more like you have a local install in the folder you first run it from.
Having said that, the "@composer" modification you refer to does sound like a better approach, and we can fix that

jim-parry added a commit to jim-parry/CodeIgniter4 that referenced this issue Apr 10, 2019
jim-parry added a commit to jim-parry/CodeIgniter4 that referenced this issue Apr 10, 2019
jim-parry added a commit that referenced this issue Apr 10, 2019
Update phpunit.xml scripts. Fixes #1932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants