Purifier icon indicating copy to clipboard operation
Purifier copied to clipboard

Could not load package mews/purifier in http://repo.packagist.org:

Open wikigods opened this issue 4 years ago • 21 comments

Since a few hours I have problems with package and tried in laravel 7 but I get this error

[RuntimeException] Could not load package mews/purifier in http://repo.packagist.org: [UnexpectedValueException] Could not parse version constraint ~4.: Invalid version string "~4."

[UnexpectedValueException] Could not parse version constraint ~4.: Invalid version string "~4."

wikigods avatar Sep 10 '20 19:09 wikigods

same

bbashel1 avatar Sep 10 '20 20:09 bbashel1

same problem here

tpaskett avatar Sep 10 '20 20:09 tpaskett

Running composer self-update fixed the problem for me.

jeremyjaymes avatar Sep 10 '20 21:09 jeremyjaymes

Thanks jeremyjaymes it worked

wikigods avatar Sep 10 '20 22:09 wikigods

same

lionslair avatar Sep 11 '20 02:09 lionslair

same issue

shalinimonad avatar Sep 11 '20 05:09 shalinimonad

same here too

amaelftah avatar Sep 11 '20 06:09 amaelftah

Does anyone understand what the issue is and why updating composer fixes it? Is it some composer.json file change that is only present in newer versions?

lionslair avatar Sep 11 '20 06:09 lionslair

Running composer self-update fixed the problem for me.

work like a charm thanks!

bennyxguo avatar Sep 11 '20 07:09 bennyxguo

Running composer self-update fixed the problem for me.

Can confirm that this solution works.

For those who are confused. Run the following command, then run composer update

$ composer self-update && composer update

BippyMiester avatar Sep 11 '20 08:09 BippyMiester

Can also confirm the solution, but I needed to do some additional steps. This were my steps, because we have a composer installation done with the package manager of the linux sistem: sudo apt-get remove composer sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" sudo php composer-setup.php sudo php -r "unlink('composer-setup.php');" sudo mv composer.phar /usr/local/bin/composer

I would really like to know the underlying problem as we have quite a few automated updates on hold now so that we don't have offline sites.

MundaPlus avatar Sep 11 '20 08:09 MundaPlus

same issue, composer self-update does not fix it. recently i have also discovered issues with packagist and changed to a mirror.

switch to mirror: composer config -g repos.packagist composer https://packagist.fi

composer.json:

"repositories": [
        {
            "type": "composer",
            "url": "https://packagist.fi"
        },
        {
            "packagist": false
        }
    ],

switch back to official: composer config -g repos.packagist composer https:/repo.packagist.org

check global config: composer config -g -l

Could not load package mews/purifier in https://packagist.fi: [UnexpectedValueException] Could not parse version constraint ~4.: Invalid version string "~4."

Solved! reinstall composer:

sudo rm -f /usr/local/bin/composer
sudo curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

davidvandertuijn avatar Sep 11 '20 09:09 davidvandertuijn

Just to confirm, switching to the correct composer version fixed it for me too!

GJPhilippi avatar Sep 11 '20 18:09 GJPhilippi

Same issue! :(

ppalella avatar Sep 14 '20 21:09 ppalella

If you delete the vendor directory, then you can remove purifier from composer.json and run composer install to fix the problem, although this will remove Purifier from your project.

KeithTurkowski avatar Sep 15 '20 02:09 KeithTurkowski

If anyone tried self-update and got an error about self-update is not defined, remove all versions of composer.

I had one installed via apt-get and one manually with curl/wget.

mrbenosborne avatar Sep 21 '20 10:09 mrbenosborne

Same problem here and the composer self-update didn't fix it. I'm on Laravel 6.

julie-langanay avatar Oct 05 '20 12:10 julie-langanay

I was able to solve the issue by switching to the correct build of Composer instead of using the version available on my OS (Kubuntu). I had to reinstall composer manually for it, @ibeona.

First uninstall the OS-installed version (in Debian based OSes run: sudo apt remove --purge composer) and then install the correct one from https://getcomposer.org/

EDIT: @mrbenosborne I misread your comment at first, sorry to nudge you!

GJPhilippi avatar Oct 05 '20 12:10 GJPhilippi

@GJPhilippi i've tested composer 1.9 and composer 1.10, i'm in a docker container. I've tested by building the container with both versions but same error each time :( .
Or do i have to switch to composer 2.0 ?

julie-langanay avatar Oct 05 '20 13:10 julie-langanay

@ibeona No, Composer 2.0 isn't publicly available, so you shouldn't switch to it. I use Composer version 1.10.13 2020-09-09 11:46:34, without a Docker container and works perfectly fine. Check that you use the correct Docker container and perhaps do a pull to get the latest version of the Docker image.

GJPhilippi avatar Oct 05 '20 13:10 GJPhilippi

@ibeona No, Composer 2.0 isn't publicly available, so you shouldn't switch to it. I use Composer version 1.10.13 2020-09-09 11:46:34, without a Docker container and works perfectly fine.

Ok, i tried with composer 1.10.13 in docker tag still not working but i'll investigate and search about docker issue so ! Thank you for your time!

julie-langanay avatar Oct 05 '20 13:10 julie-langanay