<p>Very similar to Devin's answer.<br />
I came up against this on Friday and I had to follow these steps to resolve this issue.</p>
<ol>
<li>Nuke the vendor folder within the project. <code>rm -rf vendor/</code></li>
<li>Nuke the composer.lock file within the project. <code>rm composer.lock</code></li>
<li>Clear the composer cache <code>composer clearcache</code> within the project.</li>
<li>Rollback to composer v1 <code>composer self-update --1</code></li>
<li>Update composer globally to smooth it out <code>composer global update</code></li>
<li>Then reinstall <code>composer install</code> within the project.</li>
<li>Finally, I was able to run <code>./craft update all</code></li>
</ol>
<p>Hope this helps anyone else who comes up against this. It took several hours to resolve and figure out the necessary steps.</p>

CC BY-SA 4.0
2021-03-31T09:59:41.373Z
Thanks, @terry-upton, for taking the time to post your solution. *thumbs up*
Mario
CC BY-SA 4.0
2021-12-29T17:16:06.140Z
also, deleting .config/composer/vendor is needed because composer global clearcache also fails
hbt
CC BY-SA 4.0
2023-01-02T21:38:10.953Z
I had success by doing the same, the only difference was, running _composer global update_ balked, I ended up doing _composer update_ instead.
4midori
CC BY-SA 4.0
2021-01-11T10:07:22.380Z
2021-01-11T10:07:22.380Z
Terry Upton
<p>The problem seems to be with parsing <code>vendor/composer/installed.json</code>
Once I deleted it - install went well. Even without deleting other files. This one is generated one. You can also simply remove whole <code>vendor/composer</code> directory.</p>

CC BY-SA 4.0
2021-05-14T08:44:16.087Z
2021-05-14T08:44:16.087Z
Zebooka
<pre><code>rm vendor/composer/installed.json 
composer install 
</code></pre>
<p>Maybe installed.json  was generated with composer 2.x and you are trying run it now with composer 1.6 or 1.8.</p>
<p>Also maybe update composer it also fixes the problem</p>

CC BY-SA 4.0
2021-08-17T18:12:29.033Z
2021-08-17T18:12:29.033Z
Sérgio
<p>I managed to solve this by running:</p>
<ol>
<li><code>rm -rf vendor/</code></li>
<li><code>rm composer.lock</code></li>
</ol>
<p>At this point, the error still persisted when running <code>composer update</code> or <code>composer dumpauto</code> but then after running:</p>
<ol start="3">
<li><code>composer global clearcache</code></li>
</ol>
<p>everything worked as per normal.</p>
<p>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.</p>

CC BY-SA 4.0
2021-01-10T11:33:07.410Z
2021-01-10T11:33:07.410Z
Devin Norgarb
<p>The JSON object being returned with the error appeared to be related to a JSON object containing all the globally installed packages.</p>
<p>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.</p>

CC BY-SA 4.0
2020-11-25T15:33:56.537Z
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.
CC BY-SA 4.0
2020-12-02T17:47:24.127Z
I did experiment with Composer 2 at some point prior to this issue. That may be the issue.
Jason
CC BY-SA 4.0
2020-12-31T17:32:58.720Z
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
CC BY-SA 4.0
2020-11-04T21:02:51.467Z
2020-11-04T21:02:51.467Z
Jason
<p>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.</p>
<p>I was using composer 2.0.9</p>
<p>But when i changed my composer to 1.8.4 solved my issue</p>

CC BY-SA 4.0
2021-02-16T10:17:28.750Z
2021-02-16T10:17:28.750Z
Tiago André
<p>Make sure you are running this as the correct user.</p>
<p>I ran in the same problem and was about to delete everything according to the solution by Terry when I noticed I hadn't the permission to delete the files.</p>
<p>Switched to the user I used to create the project and the composer commands worked (without having to delete anything).</p>

CC BY-SA 4.0
2021-08-19T07:38:45.400Z
2021-08-20T05:17:21.257Z
2021-08-20T05:17:21.257Z
Gerald Schneider
<p>Upgrading from Craft 3.4.20 running Composer 1.10.17 on PHP 7.2. Running <code>./craft update all</code> returns the following error:</p>
<pre><code>error: Unknown package has no name defined. [followed by JSON object related to GuzzleHTTP]
</code></pre>
<p>The error appears to be related to GuzzleHTTP. For testing I did the following:</p>
<ol>
<li>Deleted the <code>/vendor</code> directory.</li>
<li>Deleted the <code>composer.lock</code> file.</li>
<li>Removed all <code>composer.json</code> dependencies except <code>craftcms/cms</code>, <code>vlucas/phpdotenv</code> and <code>ext-json</code>.</li>
<li>Ran <code>composer install</code>.</li>
<li>Ran <code>./craft update all</code>.</li>
</ol>
<p>Yielded same error.</p>
<p>Unfortunately, I am unable to find any information about this error from Composer documentation or bug reports.</p>

<craft3><updates><composer>
"Unknown package has no name defined" composer error on upgrade
# "Unknown package has no name defined" composer error on upgrade

(Asked by: username_0 on 2020-11-04)

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:

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

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

**Tags:** craft3, updates, composer

---

## 7 answers

### Answer by username_1 on 2021-01-11. Score: 17

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.

> **Comments:**
> **username_2**: Thanks, @terry-upton, for taking the time to post your solution. *thumbs up*  
> **username_3**: also, deleting .config/composer/vendor is needed because composer global clearcache also fails  
> **username_4**: I had success by doing the same, the only difference was, running _composer global update_ balked, I ended up doing _composer update_ instead.  

---

### Answer by username_5 on 2021-05-14. Score: 11

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.


---

### Answer by username_6 on 2021-08-17. Score: 5

rm vendor/composer/installed.json 
composer install 

Maybe installed.json  was generated with composer 2.x and you are trying run it now with composer 1.6 or 1.8.
Also maybe update composer it also fixes the problem


---

### Answer by username_7 on 2021-01-10. Score: 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:

3. `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.


---

### Answer by username_0 on 2020-11-04. Score: 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.

> **Comments:**
> **username_8**: 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.  
> **username_0**: I did experiment with Composer 2 at some point prior to this issue. That may be the issue.  
> **username_9**: 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.  

---

### Answer by username_10 on 2021-02-16. Score: 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


---

### Answer by username_11 on 2021-08-19. Score: 1

Make sure you are running this as the correct user.

I ran in the same problem and was about to delete everything according to the solution by Terry when I noticed I hadn't the permission to delete the files.

Switched to the user I used to create the project and the composer commands worked (without having to delete anything).


---

