Yii2: Composer error "Content-Length Mismatch" again

Created on 29 Oct 2019  路  3Comments  路  Source: yiisoft/yii2

This afternoon Composer started throwing the "Content-Length Mismatch" error on me.

Running composer diagnose gives...

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
Dev Public Key Fingerprint: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
OK
Checking composer version: OK
Composer version: 1.9.0
PHP version: 7.3.11
PHP binary path: /usr/local/Cellar/php/7.3.11/bin/php

& my Composer config.json is...

{
    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "https://packagist.org"
        }
    },
    "config": {
        "github-protocols": ["https", "ssh"]
    }
}

I'm reporting it here because the default composer.json for yii2-advanced is...

    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]

& I found that changing that in a couple of projects to...

    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    ]

resolved it in those.

Update: My source for making that change is this thread on the Composer repo.

Most helpful comment

& I found that changing that in a couple of projects to...

    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    ]

resolved it in those.

This change looks incorrect. https://packagist.phpcomposer.com seems to be some Chinese proxy, you shouldn't use it if you're not from China. I'm also not sure if it contains packages available at https://asset-packagist.org, so this change may affect list of available packages and make some composer update calls impossible.

Anyway, this is issue with asset-packagist, you can track progress here: https://github.com/hiqdev/asset-packagist/issues/105

All 3 comments

Server is out of free space. More storage is being added at the moment. Should be resolved soon.

& I found that changing that in a couple of projects to...

    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    ]

resolved it in those.

This change looks incorrect. https://packagist.phpcomposer.com seems to be some Chinese proxy, you shouldn't use it if you're not from China. I'm also not sure if it contains packages available at https://asset-packagist.org, so this change may affect list of available packages and make some composer update calls impossible.

Anyway, this is issue with asset-packagist, you can track progress here: https://github.com/hiqdev/asset-packagist/issues/105

Update: On later runs Composer sometimes using https://packagist.phpcomposer.com sometimes gave an out of memory error (roughly every other time). Pursing that I pointed Terminal to ~/.composer, deleted the contents of cache & vendor, then ran composer update -v from that location. That did not stop the memory errors, but when I tried https://asset-packagist.org again, the content length mismatch no longer occured. Perhaps work that @samdark mentioned had been completed by then.

Was this page helpful?
0 / 5 - 0 ratings