Composer path length error on Windows

1 min.

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.

Do you have comments? Tweet X it at me.

Keep up with me

Consider subscribing. There's also an RSS feed if you're into that.

Wanna reach out? Tweet at me or drop me a line: golb [tod] sadat [ta] olleh.

Est. 2011