0

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

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?

8
  • Please post the full content of your composer.json file.
    – MoritzLost
    Aug 4 at 7:58
  • Ok I've added the full composer.json file.
    – cannon303
    Aug 4 at 10:02
  • 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.
    – MoritzLost
    Aug 4 at 10:57
  • 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.
    – cannon303
    Aug 4 at 11:35
  • 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?
    – cannon303
    Aug 4 at 12:00

1 Answer 1

0

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 for details.

4
  • 1
    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.
    – CraftQuest
    Aug 4 at 14:43
  • @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.
    – MoritzLost
    Aug 4 at 14:54
  • 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!
    – cannon303
    7 hours ago
  • 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: craftcms.stackexchange.com/questions/36551/…
    – cannon303
    7 hours ago

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.