When I run:
php composer.phar require kartik-v/yii2-widgets "*"
I get the following output (using the -vvv verbose flag):
- Installing kartik-v/bootstrap-fileinput (v4.1.7)
Downloading https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/f95a7e5fa0a9db1ead445e438653aa71e9f599f9
Downloading: connection...
Downloading: 0%
Downloading: 5%
...
Downloading: 95%
Downloading: 100%
Downloading: 100%
Writing C:/Users/Michael/AppData/Local/Composer/files/kartik-v/bootstrap-fileinput/f95a7e5fa0a9db1ead445e438653aa71e9f599f9.zip into cache
Extracting archive
[ErrorException]
ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:79
Composer\Util\ErrorHandler::handle() at n/a:n/a
ZipArchive->extractTo() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:79
Composer\Downloader\ZipDownloader->extract() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ArchiveDownloader.php:44
Composer\Downloader\ArchiveDownloader->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/DownloadManager.php:201
Composer\Downloader\DownloadManager->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:156
Composer\Installer\LibraryInstaller->installCode() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:87
Composer\Installer\LibraryInstaller->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:152
Composer\Installer\InstallationManager->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:139
Composer\Installer\InstallationManager->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:578
Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:225
Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/RequireCommand.php:154
Composer\Command\RequireCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:147
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:84
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:25
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [packages1] ... [packagesN]
I even tried using the flag "--prefer-source" but I get the same error. Is there a way to tell composer to increase the MAXPATHLEN? Which path exactly is it complaining about?
try using the --prefer-source flag
composer install --prefer-source
Composer is complaining about a path that is too long for PHP on Windows in the download. Windows has a max path length (MAXPATHLEN) of 260 characters so I don't think you can change that.
When I had this problem when installing Symfony, I fixed it by using a short path for the project directory (such as C:\projects\myproject).
While investigating this problem, I found it can also be fixed by using the --prefer-source flag when installing, like this:
php composer.phar install --prefer-source
Note that you need git in your Windows shell path for this to work, as this checks out the source from Github rather than downloading the distribution file. It is also slower.
Note also that you might have to remove the vendor/
folder before installing again using the --prefer-source
flag:
rm -rf vendor/
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