-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
Description
Setup
Mac running latest MacOS (Sierra 10.12.5) Composer v1.5.1 WP-CLI v1.3
Issue
If you run wp package install <package> and the package is not valid and composer fails for some reason (in my case it was out of memory) then .wp-cli/packages/composer.json is not reverted and the invalid package is left in the require section. This means that subsequent wp package installs will fail.
Can this be handled better?
Steps to reproduce
- Edit
php.iniand set yourmemory_limitlow so that composer update fails (mine failed with128M) - Run
wp package install runcommand/dist-archive- this gave me the following output before running out of memory:
Installing package runcommand/dist-archive (dev-master)
Updating /Users/rosswintle/.wp-cli/packages/composer.json to require the package...
Registering git@github.com:runcommand/dist-archive.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
- Note that
composer.jsonwas not reverted and now contains an invalid package reference (asruncommand/dist-archivedoesn't work for some reason - Edit
php.iniand set yourmemory_limitback to something higher - Run
wp package install runcommand/dist-archive- this runs right though untilError: Package installation failed (Composer return code 2). Reverted composer.json - Realise that the package is now in a different place and run
wp package install wp-cli/dist-archive-command- this fails becauseThe requested package runcommand/dist-archive could not be found in any version, there may be a typo in the package name. - All subsequent attempts to install a package fail because the incorrect package name is in the
composer.json
This seems like an edge case, but I wonder if there are other cases where the requires section of composer.json may become invalid (if a package is deleted from GitHub, perhaps?) and prevent further package installs?
Reactions are currently unavailable