Answers.Body: <p>You have fixed version constraints in your <code>composer.json</code>, so <code>composer install</code> and <code>composer update</code> will only ever install those exact versions.  In general, you should use the <code>update/all</code> console command to update Craft and any installed plugins, as this will also execute any pending migrations. The error you're getting is unrelated to this and is likely only a compatibility issue between different composer versions.</p>
  <p>To fix this, follow the following steps to first get back to a clean composer install and then use the console to update to Craft 3.7. You should do this in a development environment where you have control over your environment and can go back to a previous version easily if something goes wrong.</p>
  <ol>
  <li>Delete the <code>vendor</code> folder and the <code>composer.lock</code> file.</li>
  <li>Execute <code>composer install</code>. If you're getting any errors regarding version conflicts, change the version requirements for the installed packages to compatible versions.</li>
  </ol>
  <p>Once the installation goes through cleanly, use <code>php craft update/all</code> to update to the latest Craft 3.7 version. See the <a href="https://craftcms.com/docs/4.x/updating.html#updating-from-the-terminal" rel="nofollow noreferrer">update guide</a> for details.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-04T14:43:26.700Z
Answers.Text: One note: you shouldn't mix using `composer update` and `craft update/all` because of how Craft pins your versions in `composer.json`. Pick one way and always use it. I like `composer update`, followed by `craft migrate/all`.
Answers.UserDisplayName: CraftQuest
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-04T14:54:31.177Z
Answers.Text: @CraftQuest With a standard install based on the starter project, `composer update` will not update Craft or any plugins though, since the version constraints are pinned to exact versions. Same goes if you've previously used `php craft update all`, since that command pins specific versions as well. I like having fixed versions for Craft and plugins and using `php craft update all`, because it performs migrations in the same step. This way, I can use `composer update` to update all packages _except_ Craft and plugins and I can be sure I'm not missing any migrations.
Answers.UserDisplayName: MoritzLost
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-08T20:47:45.757Z
Answers.Text: After installing the website locally and getting it to work (which was fun). I followed the instructions, I deleted the vendor folder and composer.lock, ran composer install (no errors), ran php craft update all, it said performing 1 update : - craft 3.1.18 => 3.7.50 (CRITICAL), all good then ran it and same error: error: Unknown package has no name defined ([{"name":"adigital\/cookie-consent-banner".... so still not working!
Answers.UserDisplayName: cannon303
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-08T21:24:51.847Z
Answers.Text: Update: I followed these instructions and it generated a different error. However when I tried to log back in it gave me the option to upgrade the database and once that happened everything was up to date: https://craftcms.stackexchange.com/questions/36551/unknown-package-has-no-name-defined-composer-error-on-upgrade
Answers.UserDisplayName: cannon303
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-04T13:00:52.393Z
Answers.LastActivityDate: 2022-08-04T13:00:52.393Z
Answers.UserDisplayName: MoritzLost
Body: <p>Hi I cannot install Craft CMS updates. I have version 3.1.18 and I'm trying to update to 3.7.50</p>
  <p>I have updated Composer successfully. I did however have a platform PHP 7 issue listed in composer.json which was overriding the server version required for the update. I wish I had just manually removed the line from the file to see if that would have fixed it but instead followed an instruction on github to use command: <code>composer config platform --unset</code> this didn't work when I then tried to update but I had noticed terminal that the response from the --unset request was that some plugins were skipped and that I should use command <code>composer update --no-plugins</code> which I tried.</p>
  <p>From now on when I try to run the Craft update I get the error:</p>
  <p><code>Composer was unable to install the updates. Error: Unknown package has no name defined</code> then proceeds to list the plugins. I cannot uninstall any plugins either to see if that would help. I have followed the advice on this post:</p>
  <p><a href="https://craftcms.stackexchange.com/questions/36605/error-unknown-package-has-no-name-defined-when-updating-craft-3">&quot;Error: Unknown package has no name defined&quot; when updating Craft 3</a></p>
  <p>I couldn't delete the vendor folder as suggested in that post as access is denied for some reason but I could rename it. It still doesn't work though and I still get the same error when trying to update Craft.</p>
  <p>This is the full composer.json file:</p>
  <pre><code>{
    &quot;require&quot;: {
      &quot;adigital/cookie-consent-banner&quot;: &quot;1.2.9&quot;,
      &quot;craftcms/cms&quot;: &quot;3.1.18&quot;,
      &quot;craftcms/redactor&quot;: &quot;2.3.3.2&quot;,
      &quot;dolphiq/redirect&quot;: &quot;1.1.1&quot;,
      &quot;vlucas/phpdotenv&quot;: &quot;^2.4.0&quot;
    },
    &quot;autoload&quot;: {
      &quot;psr-4&quot;: {
        &quot;modules\\&quot;: &quot;modules/&quot;
      }
    },
    &quot;config&quot;: {
      &quot;sort-packages&quot;: true,
      &quot;optimize-autoloader&quot;: true,
      &quot;allow-plugins&quot;: {
        &quot;yiisoft/yii2-composer&quot;: true,
        &quot;craftcms/plugin-installer&quot;: true
      }
    },
    &quot;scripts&quot;: {
      &quot;post-root-package-install&quot;: [
        &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;
      ]
    }
  }
  </code></pre>
  <p>I have searched other solutions but have now arrived at a dead end.</p>
  <p>What am I missing please?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T07:58:51.223Z
Comments.Text: Please post the full content of your `composer.json` file.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T10:02:53.440Z
Comments.Text: Ok I've added the full composer.json file.
Comments.UserDisplayName: cannon303
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T10:57:21.850Z
Comments.Text: Try to delete the composer.lock as well as the vendor folder. Then install the most up-to-date version of Composer and use composer update. Don't use --no-plugins, the Composer plugins are required to make sure plugins are installed correctly in the right place.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T11:35:02.650Z
Comments.Text: Thanks but it didn't work. I couldn't delete the vendor folder but could rename it and I deleted composer.lock, then ran composer install and composer update. This generated a new vendor folder and new composer.lock file but still get the same error when I try to run the craft update.
Comments.UserDisplayName: cannon303
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T12:00:43.153Z
Comments.Text: I got on to server support and they changed permissions so I can delete vendor folders now but still keep hitting the same error. If I run composer install will this install the most up to date version or should I specify a version number to install?
Comments.UserDisplayName: cannon303
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T12:05:00.600Z
Comments.Text: If you run `composer install` after deleting the `vendor` folder and the `composer.lock` file, Composer will download the newest versions of all dependencies that are listed in your `composer.json`, accoring to your version constraints. For example, `"craftcms/cms": "3.1.18"` means you get the newest Craft 3.x.x version, but not Craft 4.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T12:37:31.330Z
Comments.Text: Yes I'm not after craft 4 but want the newest craft 3x yet still I get the same error. Is there anything else you can think of that might work?
Comments.UserDisplayName: cannon303
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T12:53:17.607Z
Comments.Text: Ah I see you have fixed version constraint, so `composer install` / `composer update` can only ever install those exact versions. I'll write up an answer that should solve this.
Comments.UserDisplayName: MoritzLost
Tags: <craft3><updates><composer>
Title: Composer was unable to install the updates. Error: Unknown package has no name defined
ThreadText: # Composer was unable to install the updates. Error: Unknown package has no name defined
  
  (Asked by: username_0 on 2022-08-03)
  
  Hi I cannot install Craft CMS updates. I have version 3.1.18 and I'm trying to update to 3.7.50
  
  I have updated Composer successfully. I did however have a platform PHP 7 issue listed in composer.json which was overriding the server version required for the update. I wish I had just manually removed the line from the file to see if that would have fixed it but instead followed an instruction on github to use command: `composer config platform --unset` this didn't work when I then tried to update but I had noticed terminal that the response from the --unset request was that some plugins were skipped and that I should use command `composer update --no-plugins` which I tried.
  
  From now on when I try to run the Craft update I get the error:
  
  `Composer was unable to install the updates. Error: Unknown package has no name defined` then proceeds to list the plugins. I cannot uninstall any plugins either to see if that would help. I have followed the advice on this post:
  
  ["Error: Unknown package has no name defined" when updating Craft 3](https://craftcms.stackexchange.com/questions/36605/error-unknown-package-has-no-name-defined-when-updating-craft-3)
  
  I couldn't delete the vendor folder as suggested in that post as access is denied for some reason but I could rename it. It still doesn't work though and I still get the same error when trying to update Craft.
  
  This is the full composer.json file:
  
  ```
  {
    "require": {
      "adigital/cookie-consent-banner": "1.2.9",
      "craftcms/cms": "3.1.18",
      "craftcms/redactor": "2.3.3.2",
      "dolphiq/redirect": "1.1.1",
      "vlucas/phpdotenv": "^2.4.0"
    },
    "autoload": {
      "psr-4": {
        "modules\\": "modules/"
      }
    },
    "config": {
      "sort-packages": true,
      "optimize-autoloader": true,
      "allow-plugins": {
        "yiisoft/yii2-composer": true,
        "craftcms/plugin-installer": true
      }
    },
    "scripts": {
      "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
      ]
    }
  }
  
  ```
  
  I have searched other solutions but have now arrived at a dead end.
  
  What am I missing please?
  
  **Tags:** craft3, updates, composer
  
  > **Comments:**
  > **username_1**: Please post the full content of your `composer.json` file.  
  > **username_0**: Ok I've added the full composer.json file.  
  > **username_1**: Try to delete the composer.lock as well as the vendor folder. Then install the most up-to-date version of Composer and use composer update. Don't use --no-plugins, the Composer plugins are required to make sure plugins are installed correctly in the right place.  
  > **username_0**: Thanks but it didn't work. I couldn't delete the vendor folder but could rename it and I deleted composer.lock, then ran composer install and composer update. This generated a new vendor folder and new composer.lock file but still get the same error when I try to run the craft update.  
  > **username_0**: I got on to server support and they changed permissions so I can delete vendor folders now but still keep hitting the same error. If I run composer install will this install the most up to date version or should I specify a version number to install?  
  > **username_1**: If you run `composer install` after deleting the `vendor` folder and the `composer.lock` file, Composer will download the newest versions of all dependencies that are listed in your `composer.json`, accoring to your version constraints. For example, `"craftcms/cms": "3.1.18"` means you get the newest Craft 3.x.x version, but not Craft 4.  
  > **username_0**: Yes I'm not after craft 4 but want the newest craft 3x yet still I get the same error. Is there anything else you can think of that might work?  
  > **username_1**: Ah I see you have fixed version constraint, so `composer install` / `composer update` can only ever install those exact versions. I'll write up an answer that should solve this.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-04. Score: 1
  
  You have fixed version constraints in your `composer.json`, so `composer install` and `composer update` will only ever install those exact versions. In general, you should use the `update/all` console command to update Craft and any installed plugins, as this will also execute any pending migrations. The error you're getting is unrelated to this and is likely only a compatibility issue between different composer versions.
  
  To fix this, follow the following steps to first get back to a clean composer install and then use the console to update to Craft 3.7. You should do this in a development environment where you have control over your environment and can go back to a previous version easily if something goes wrong.
  
  1. Delete the `vendor` folder and the `composer.lock` file.
  2. Execute `composer install`. If you're getting any errors regarding version conflicts, change the version requirements for the installed packages to compatible versions.
  
  Once the installation goes through cleanly, use `php craft update/all` to update to the latest Craft 3.7 version. See the [update guide](https://craftcms.com/docs/4.x/updating.html#updating-from-the-terminal) for details.
  
  > **Comments:**
  > **username_2**: One note: you shouldn't mix using `composer update` and `craft update/all` because of how Craft pins your versions in `composer.json`. Pick one way and always use it. I like `composer update`, followed by `craft migrate/all`.  
  > **username_1**: @username_2 With a standard install based on the starter project, `composer update` will not update Craft or any plugins though, since the version constraints are pinned to exact versions. Same goes if you've previously used `php craft update all`, since that command pins specific versions as well. I like having fixed versions for Craft and plugins and using `php craft update all`, because it performs migrations in the same step. This way, I can use `composer update` to update all packages _except_ Craft and plugins and I can be sure I'm not missing any migrations.  
  > **username_0**: After installing the website locally and getting it to work (which was fun). I followed the instructions, I deleted the vendor folder and composer.lock, ran composer install (no errors), ran php craft update all, it said performing 1 update : - craft 3.1.18 => 3.7.50 (CRITICAL), all good then ran it and same error: error: Unknown package has no name defined ([{"name":"adigital\/cookie-consent-banner".... so still not working!  
  > **username_0**: Update: I followed these instructions and it generated a different error. However when I tried to log back in it gave me the option to upgrade the database and once that happened everything was up to date: https://craftcms.stackexchange.com/questions/36551/unknown-package-has-no-name-defined-composer-error-on-upgrade  
  
  ---
  
  