Flex: New 5.x version breaks Flex versions 1.5.2 and lower

Created on 8 Oct 2020  路  3Comments  路  Source: symfony/flex

Hi!

I'm not sure there is anything we can do about it, but due to the new 5.x on https://flex.symfony.com/versions.json, Flex is broken (no update or require options can be made) on versions 1.5.2 and lower. The fix is #580

On 1.5.2 or lower, depending on the exact command you're running and the exact version of Flex, you will probably get:

Uncaught Error: Call to a member function getVersions() on null in /Users/koff.pro/Downloads/code-messenger/start/vendor/symfony/flex/src/Cache.php

Or

Invalid version string "5.x"

The FIX

The fix is to upgrade symfony/flex with some flags to avoid it doing its normal job (which causes the error):

composer update symfony/flex --no-plugins --no-scripts

# or, if you have memory errors
COMPOSER_MEMORY_LIMIT=-1 composer update symfony/flex --no-plugins --no-scripts

Most helpful comment

Just leaving this here in case someone stumbles over it: I had an installation with symfony/flex being installed globally. This then also broke creating projects with symfony new. Removing the global package resolves this of course but it might be not obvious what is causing the trouble.

All 3 comments

if you run with --no-plugins, I don't even think you need to first remove the vendor folder

This is similar to #683
The fix has been released a few weeks ago already.
We cannot do better (but document of course, as done in this issue)

Just leaving this here in case someone stumbles over it: I had an installation with symfony/flex being installed globally. This then also broke creating projects with symfony new. Removing the global package resolves this of course but it might be not obvious what is causing the trouble.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emulienfou picture emulienfou  路  4Comments

marcw picture marcw  路  4Comments

Deltachaos picture Deltachaos  路  5Comments

javiereguiluz picture javiereguiluz  路  6Comments

soullivaneuh picture soullivaneuh  路  6Comments