6

Upgrading from Craft 3.4.20 running Composer 1.10.17 on PHP 7.2. Running ./craft update all returns the following error:

error: Unknown package has no name defined. [followed by JSON object related to GuzzleHTTP]

The error appears to be related to GuzzleHTTP. For testing I did the following:

  1. Deleted the /vendor directory.
  2. Deleted the composer.lock file.
  3. Removed all composer.json dependencies except craftcms/cms, vlucas/phpdotenv and ext-json.
  4. Ran composer install.
  5. Ran ./craft update all.

Yielded same error.

Unfortunately, I am unable to find any information about this error from Composer documentation or bug reports.

6

Very similar to Devin's answer.
I came up against this on Friday and I had to follow these steps to resolve this issue.

  1. Nuke the vendor folder within the project. rm -rf vendor/
  2. Nuke the composer.lock file within the project. rm composer.lock
  3. Clear the composer cache composer clearcache within the project.
  4. Rollback to composer v1 composer self-update --1
  5. Update composer globally to smooth it out composer global update
  6. Then reinstall composer install within the project.
  7. Finally, I was able to run ./craft update all

Hope this helps anyone else who comes up against this. It took several hours to resolve and figure out the necessary steps.

1
  • Thanks, @terry-upton, for taking the time to post your solution. thumbs up – Mario Mar 31 at 9:59
5

I managed to solve this by running:

  1. rm -rf vendor/
  2. rm composer.lock

At this point, the error still persisted when running composer update or composer dumpauto but then after running:

  1. composer global clearcache

everything worked as per normal.

My guess is something got corrupted within in composers' global cache. I am not sure if the first two steps are necessary but that's how I managed to fix it.

2

The JSON object being returned with the error appeared to be related to a JSON object containing all the globally installed packages.

After 2 hours of unsuccessful debugging, I completely reinstalled composer (same version) and the issue appears to have resolved itself. Unsure as to the exact cause, but possibly my global composer.json was corrupt.

3
  • 1
    Did you by any chance experiment with Composer 2? I got the same error after rebuilding a Docker container that had Composer 2 and the rebuild rolled it back to version 1 but some Composer directory was persisted in a volume and I guess I had mixed files from different versions. In my case upgrading composer to version 2 again resolved the issue. – Rafał G. Nov 25 '20 at 15:33
  • I did experiment with Composer 2 at some point prior to this issue. That may be the issue. – Jason Dec 2 '20 at 17:47
  • For me, I downgraded to composer 1 "composer self-update --1" then ran "composer global update" and was able to run update through the CLI and the app. – Nicolas Binet Dec 31 '20 at 17:32
1

i was having this error i tried the things you say here like deleting the vendor, the lock and clear cache and didn't work.

I was using composer 2.0.9

But when i changed my composer to 1.8.4 solved my issue

1

The problem seems to be with parsing vendor/composer/installed.json Once I deleted it - install went well. Even without deleting other files. This one is generated one. You can also simply remove whole vendor/composer directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.