When I try to create a new laravel project with "laravel new project" I got this error:
Content-Length mismatch
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
When I do "composer update" or "composer install doctrine/dbal", I got the error too. And my composer is too slow.
Just note useful information for this error: This is a network error regarding ipv6. I can't know exactly what causes it. But we can fix it through a workaround solution
Workaround Linux: Run command
$ sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
Workaround Windows:
On windows, the only way is to disable ipv6 entirely I am afraid (either in windows or in your home router).
Workaround Mac OS X: Get the name of your network device:
$ networksetup -listallnetworkservices
Disable IPv6 on that device (in this case "Wi-Fi"):
$ networksetup -setv6off Wi-Fi
Run Composer ...
You can enable IPv6 again with:
networksetup -setv6automatic Wi-Fi
That said, if this fixes your problem, please talk to your ISP about it to try to resolve the routing errors. That's the best way to get things resolved for everyone.
Refer to this article: https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
clear the composer cache with the following command:
composer clear-cache
I got this same error and solved it only changing the http
protocol in composer repository config with https
:
composer config -g repo.packagist composer https://packagist.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With