0

I have recently created fresh Laravel project using composer. The Laravel version is 7.15.

Now when I am trying to install composer laravel/ui package, following error occures

Content-Length mismatch, received 376567 bytes out of the expected 1478361
https://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

I tried to run composer update command but same error is occuring.

This error didn't occur when I installed laravel. I haven't updated the composer.

After googling, I found this answer on Stackoverflow, https://stackoverflow.com/a/38635258 but unfortunately it's not working for me.

I even tried reinstalling the composer but error remains the same (Reinstalling the composer had worked for me in the past)

I am sharing my config.json as well as composer.json.

config.json

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

composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^1.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "^7.0",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^2.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

Output of composer diagnose

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E57DC31 7ECC7CC5 573890D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC0265 2F0C1167 CBBC8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.10.7
PHP version: 7.4.1
PHP binary path: C:\xampp\php\php.exe
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

Kindly help me out, without composer I can't proceed with my Laravel project.

Fahad Shaikh
  • 307
  • 4
  • 16

2 Answers2

3

It seems they are having bandwidth issues on Asia Mirror. Checkout the comment #5 from this issue.

Composer Update Not Working

Harish ST
  • 1,475
  • 9
  • 23
1

I had the same problem and I solved it by running these 2 commands

$ composer config -g repo.packagist composer https://packagist.org
$ composer config -g github-protocols https ssh
vetjurv4
  • 35
  • 4