Composer path length error on Windows

So you did a composer install/update and got this error:

Composer error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260) 

The cause for this is the annoyingly small path length limit in Windows API, which is so easy to hit.

A simple fix would be to instruct Composer to use GIT to fetch the source instead of the main Packagist repository. Just run composer with a “prefer-source” flag:

composer install --prefer-source

Now composer will use GIT to get the sources instead of downloading zip archives from Packagist. Just be aware that it will make the process considerably slower.

Keep up with me

If you like what I do, consider subscribing. There's also RSS feed, if you prefer that.

Wanna reach out? Tweet at me or drop me an email: tl.saksualpap@olleh.

2011-2021