I've recently run into an issue when running composer install. Specially when installing the phpunit/phpunit library. I've tried clearing the composer cache, removing the vendor folder, reinstalling my dev environment, running the command with elevated privileges, and increasing the timeout but nothing seems to be working.
Specially, when I run composer create-project or composer install all the packages are downloaded and installed without issue. But when it gets to phpunit/phpunit it hangs during extraction and eventually times out, with following error
Install of phpunit/phpunit failed
The following exception is caused by a process timeout
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/local/bin/unzip' -qq '/home/vagrant/code/sites/*****/vendor/composer/tmp-9621203db1563
410535b21d5fa51d984' -d '/home/vagrant/code/sites/*****/vendor/composer/ee7cafdb'" exceeded the timeout o
f 300 seconds.
I have been able to run this command many times in the past, without any problem, this is only a recent issue.
My current dev environment is:
VirtualBox: 6.1.32
Vagrant: 2.2.19
Homestead: laravel/homestead (virtualbox, 12.0.0)
Composer: 2.25
Windows: 11
Any help is much appreciated. I've been stuck on this problem for nearly two days now, with no luck.
Related
The Composer installer script did not run correctly [exit code 259] and no output was returned.
enter image description here
I tried hard to install composer from install via cmd and even the GUI now. I have uninstalled my xampp many times to install composer and even I have also installed xampp version 5 but the result is still the same or the error remains, I have also turned off the antivirus and various others. Please help me
This error message means that the Composer installer script has encountered an error and has stopped running. The exit code 259 indicates that there was a problem with the script and it could not be completed.
To resolve this issue, follow these steps:
Check for any error messages in the terminal or log files.
Ensure that all dependencies and requirements for the composer install are met.
Check if the environment variables are set correctly.
Try running the command with elevated privileges, i.e. using sudo.
If the error persists, try uninstalling and reinstalling Composer.
If the problem persists, you can also seek assistance from the Composer community or reach out to the vendor for support.
I've gone through a bunch of website recommendations and StackOverflow answers and comments to try to figure this out, I'm at a loss now. I'm using a MacBook Pro 2019 with macOS Big Sur (latest), 16GB of RAM, using MAMP Pro with PHP 5.6 or 7.3 (compatible with the repo). The repo last had its composer updated last year.
Me#My-MacBook-Pro the-repo % composer update --verbose
Loading composer repositories with package information
Updating dependencies
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///Applications/MAMP/bin/php/composer/src/Composer/DependencyResolver/Solver.php on line 204
This happens when trying with PHP 5.6 or 7.3, which the repo and my MAMP Pro is compatible with. I use MAMP Pro because it's been the only way I could get these multi-version repos working on my Mac (which started at Catalina, and Homebrew stopped supporting old libraries, and trying to find and compile the correct libraries for PHP 5 on Mac has been a nightmare).
The repo is run on MAMP PRo Apache, PHP 5.6 or 7.3 as CGI, and with the default version set to activate CLI commands with that PHP version. Composer runs the PHP version specified there as far as I can tell. Running php -v shows the expected version either way.
% composer --version
Composer version 2.1.14 2021-11-30 10:51:43
% composer self-update
You are already using the latest available Composer version 2.1.14 (stable channel).
I tried checking https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors, as suggested. Trying those suggestions doesn't help. I upped MAMP Pro's php.ini memory to 4G for both PHP versions. Running printenv shows no COMPOSER_MEMORY_LIMIT var.
% php -d memory_limit=-1 `which composer` update
Could not open input file: composer:
I moved the vendor folder outside of the repo. Same thing. I'm at a complete loss of how to run composer update on this repo. Adding --verbose to the command showed no detailed information, I can't even tell which package it fails on.
I discovered that the problem was caused by me having MB or GB in php.ini instead of just M after the number... so I guess I forgot that bit of unintuitive formatting that PHP has for its memory limit. Silly me.
My host provider allows me to use only root user (the only one with /bin/bash) on my virtual machine that I'm using to host a drupal 8 site installed with composer.
From composer website I see they strongly advise to avoid running composer as super-user/root, they say to use composer install --no-plugins
I tried the command apt-get composer install --no-plugins but outputs the error
E: Command line option --no-plugins is not understood in combination
with the other option
I'm still running composer as root, even thought there is always an alert, how can avoid that?
If Composer is already installed, there is no need to call apt-get, which is the standard package installer on Debian systems. composer install --no-plugins does the job
I updated the homestead virtual box from v1.0.0 to v1.0.1 for a per project installation for a Laravel 5.3 application, and now whenever I vagrant up I get this error:
Running: script: Restarting Nginx
Failed to restart php7.0-fpm.service: Unit php7.0-fpm.service not found.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
Which is the cause of the 502 Bad Gateway error when attempting to run the app.
I tried some of the usual suspects:
installed the latest virtualbox and vagrant versions
removed the box and re-downloaded
provisioned
destroyed the box including files
downgraded to v1.0.0 (now have this error on this version as well)
checked composer version of laravel/homestead which was ^3.0, and attempted an update using composer, but no update available
checked laravel/homestead on github saw v3.1.0 so updated composer.json manually and updated (downgraded back to v3.0.0 since that didn't work and didn't know the implications of the update)
So I'm completely blocked now, and technically my setup is now back to what it was prior to updating to v1.0.1 so it should be working? Anyone have any other suggestions?
Okay found the answer in the github closed issue queue: https://github.com/laravel/homestead/issues/392
Short version is update laravel/homestead up to v4.0.0 in composer.json for per project installations. So "laravel/homestead": ^4.0.0
Update
Apparently you can lock yourself into PHP 7.0 if you're not ready for PHP 7.1 using version v3.1.0 according to this post:
https://www.joeferguson.me/laravel-homestead-4-0-and-box-1-0/
I'm having error during updating composer. It's a Laravel 4 project which I've downloaded from .... and first time I updated it, it was fine and got updated. but due some reason I deleted that replace it with a fresh copy of that project, but now when I started to update it, it gives me the following error:
[ErrorException]
copy(/home/username/.composer/cache/files/symfony/security-core/3a27d7b34ee6
2cb0fdf5ad970e7777912ef4722f.zip): failed to open stream: Permission denied
In between first and second update of this composer I did the following:
Tried to installed Vagrant and homestead, but failed due to some internet connection problem.
Updated Composer failed
Uninstalled vagrant and reinstall composer.
Reinstalled Composer
Updated composer (success)
Tried to install vagrant and homestead (success)
Update composer (failed)
uninstalled vagrant
Reinstalled Composer
Update Composer (failed)
The above mentioned error is getting occured again and again. I also tried 'composer clearcache' but doesn't worked. One thing which I noticed that it's been 16-19 months I'm using composer and never heard of such errors, but since I tried to install vagrant it created hurdles and errors for me.
I'm using Ubuntu 15.04
Updating Laravel 4.0 project
Updating Laravel 5
both project got updated before installing vagrant and homestead, but not now.
/var/www is under the group of 'www-data' and 'username' also the part of this group.
Any help plz!!!!!!!!!!!!!!!
I found the solution. If you see the error then it would be clear that I don't had access to the:
"/home/username/.composer/cache/files/symfony/security-core/3a27d7b34ee62cb0fdf5ad970e7777912ef4722f.zip".
When I explore this directory, I found that its owner is 'root' or 'sudo'.
So I deleted the '.composer' directory and then started to update in my laravel project directory, every thing was fine and perfect! No problem at all!
sudo composer update
worked for me. it's a permission issue.
if it doesn't work then you can try to
delete '.composer' directory and composer update afterward.
I know its an old topic, but for mac users this might be useful, since commands in macOS are a little bit different from linux distros and I had a hard time figuring this out.
cd into ~ directory
sudo chmod -R 777 .composer
Done. Now you can install/update composer.
I had the same issue with a mac, Composer warn me about running commands with super user permissions, so I've just changed the owner of files directory in the repo /Users/MyUserName/.composer/cache like so:
sudo chown -R MyUserName files/
Hope this helps.
I just run sudo before an all when ok
sudo composer create-project laravel/laravel=5.3 /Users/peter/Sites/blog --prefer-dist