The execution of composer (install, update, create-project...) hangs after composer has finished with an blinking cursor and idle cpu - but the batch script won't exit. It is possible to end the process with ctrl+c.
The problem occurs for most of my Laravel and Symfony Projects and seems not to depended on a certain composer.json / .lock
Window 10
XAMPP PHP 7.0.18
Un/reinstalled composer several times.
Examples:
composer create-project --prefer-dist laravel/laravel testapp
cd testapp
composer install
both won't exit
using --profile shows the following result:
C:\dev\killme>composer install --profile
[7.2MB/0.01s] Loading composer repositories with package information
[7.5MB/0.01s] Installing dependencies (including require-dev) from lock file
[8.5MB/0.04s] Nothing to install or update
[7.7MB/0.05s] Generating optimized autoload files
[9.6MB/7.26s] > Illuminate\Foundation\ComposerScripts::postAutoloadDump
[11.0MB/7.28s] > #php artisan package:discover
[11.1MB/7.69s] Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Package manifest generated successfully.
[10.0MB/7.71s] Memory usage: 9.99MB (peak: 11.53MB), time: 7.71s
- (blinking cursor - batch won't end)
^C cancel batch process (Y/N)? ^C
The following change worked for me:
Updating from PHP 7.0.18 to 7.1.11 (XAMPP)
Related
I am helping work on a site that uses OctoberCMS. I was trying to update to the latest release, but when I run the Artisan command to update October, I get the following error:
$ php artisan october:update
Updating October CMS...
Executing: composer update
'composer' is not recognized as an internal or external command, operable program or batch file.
[ERROR] Update failed. Check output above
However, if I run composer update directly, it works as expected:
$ composer update
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
> System\Console\ComposerScript::postAutoloadDump
INFO Discovering packages.
laravel/tinker .............................................................................. DONE
nesbot/carbon ............................................................................... DONE
nunomaduro/termwind ......................................................................... DONE
october/rain ................................................................................ DONE
94 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> System\Console\ComposerScript::postUpdateCmd
No security vulnerability advisories found
It has been close to 10 years since I did much PHP development, so my Composer-fu is more than a little rusty. If there is more info needed to help diagnose what's going on, let me know!
Environment:
Windows 11 Pro
Git Bash (running in ConEmu)
PHP 8.1.3
Composer 2.4.4
Can you try running composer in commandline/powershell? (You will likely see the same error)
'composer' is not recognized as an internal or external command, operable program or batch file.
Is not a response Git Bash or a linux like terminal would produce.
I think artisan is trying to run composer in a windows shell and can't find it in your PATH, but for some reason you have it in your Git Bash path.
Composer keeps removing the files just after it installs them!
I used composer create-project otra/skeleton --remove-vcs otra-user -vvv to debug and it shows things like :
- Installing otra/otra (1.0.0-alpha.2.4.0): Extracting archive
Executing async command (CWD): unzip -qq -o '/var/www/html/perso/otra-user/vendor/composer/tmp-ad5334fdc8c968f8ad3d54814c2b67c1' -d '/var/www/html/perso/otra-user/vendor/composer/cc30fdc4'
Executing command (CWD): rm -rf '/var/www/html/perso/otra-user/vendor/otra/otra'
Executing command (CWD): rm -rf '/var/www/html/perso/otra-user/vendor/composer/cc30fdc4'
And as usual since a few months, it finished with the infinite loop that shows :
2 packages you are using are looking for funding.
Use the composer fund command to find out more!
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Composer works like a charm before, I do not know what they have changed so I have all those issues now.
I have updated my Composer version and I did a composer diagnose but it shows nothing wrong.
I am using Composer 2.0.12 and PHP 8.0.3.
Thanks to #yivi that pointed me to an another problem in composer.json where I indeed did a loop...
I solved my problem replacing #otra-update by #otra-init in post-install-cmd and post-update-cmd which was what I really wanted to do.
Thanks for your time #Nico Haase and #yivi :)
I got some weird error code after I pulled a project out of my github. My first things I do is composer dumpautoload, composer update, and php artisan migrate:fresh --seed whenver I get to a new terminal. This time, I'm stuck at dumpautoload as it generates this error.
Here's what composer update generated
Loading composer repositories with package information
The "https://repo.packagist.org/packages.json" file could not be downloaded: SSL: An existing connection was forcibly closed by the remote host.
send of 158 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
failed to open stream: HTTP request failed!
https://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
Discovered Package: awobaz/compoships
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: spatie/laravel-medialibrary
Discovered Package: yajra/laravel-datatables-oracle
Package manifest generated successfully.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error
code -1073741819
Old (cached) local dependencies or composer.lock file may causes problem like this. You can try to reinstall all dependencies after remove all dependencies and lock file.
To remove downloaded dependencies, execute this inside app base dir;
sudo rm -rf vendor/
after that delete composer.lock file by executing;
sudo rm composer.lock
and finally execute;
composer install
Just delete the vendor file and install the composer again composer install
To resolve this, configure composer to use the https repository by running the following command on the cli before installing Laravel
composer config -g repo.packagist composer https://packagist.org
Try to create a new laravel project,
and use the new files under the storage/ & bootstrap/cache
to replace the files in the original folders.
I had the same issue and tried re-establishing the dependancies but this did not work for me. It turned out that it was the DB schema causing the issue. More specifically - I had a legacy table named settings. Once I renamed this table and followed up with composer install, the problem was solved.
I think this is due to a spatie package that creates a settings table for itself.
I'm trying to install an extension on Magento 2 via Composer, but when I run Composer update, I get the following error:
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
I try:
php -d memory_limit=-1 composer update
But I get:
Could not open input file: composer
So I tried and got:
curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...
Composer (version 1.9.0) successfully installed to: /home/customer/www/xxx/public_html/composer.phar
Use it: php composer.phar
So, thinking it's fixed I again tried and got:
php -d memory_limit=-1 composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
So I tried composer update again and got:
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
So again, I try composer update and get
Could not open input file: composer
I'm right back to where I started and incredibly confused :/ Please advise. Thank you.
When you are using php -d memory_limit=-1 you are setting an ini entry on the fly but only for the script run via that command.
Your idea to run this command was close to what you want to achieve:
php -d memory_limit=-1 composer update
The only thing you have to know is the fact that composer works as a command because it stands somewhere your OS would look for all the executables (most likely /usr/bin/composer, /usr/local/bin/composer, or something the like, this is usually referenced as the PATH). But when you try to run php composer, then composer is just considered as a regular file, and your OS do not try to look in your executable path anymore.
What you can do still is to use the command which, that will return you the path to that composer executable.
$ php $(which composer) -V
Composer version 1.8.6 2019-06-11 15:03:05
So you should be able to achieve what you aim to do via
php -d memory_limit=-1 $(which composer) install
for installation of packages; and
php -d memory_limit=-1 $(which composer) update
for updates.
Please also mind that: there is a full article in the composer documentation about memory limit: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
That could possibly ease you job, changing the relevant PHP CLI setting, or that could point you at the usage of
COMPOSER_MEMORY_LIMIT=-1 composer install
and
COMPOSER_MEMORY_LIMIT=-1 composer update
I am trying to install Drupal's OpenEdu project on Ubuntu 16.04 with composer by running the following command:
composer create-project imagex/openedu-project openedu
This produces a load of messages pertaining to PHP settings, and the project is not installed. The problem is that I cannot see all the messages on the screen (VMware console), only the last x lines.
The question is: where can I see the full result of the attempt at creation of the project?
You can redirect composer output to file:
composer create-project imagex/openedu-project openedu --no-interaction --no-progress > install.log 2>&1
And then use less to browse the file:
less install.log