I am trying to run composer update or if I tried to install any package for my site it hangs saying this
Loading composer repositories with package information
Updating dependencies (including require-dev)
But If I try composer install it is working with
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing psr/log (1.1.2): Loading from cache
- Installing symfony/polyfill-ctype (v1.13.1): Loading from cache
- Installing phpoption/phpoption (1.6.0): Loading from cache
......
I am using Laravel Homestead with vagrant and virtualbox
Whats the problem and How to solve it
composer is still hanging try to clear composer cache:
composer clear-cache
If these steps does not repair your composer then it's possible that the system does not have enough RAM memory available
Increase memory https://stackoverflow.com/a/44533437/3518053 or
Generate swap file .Try creating a swap file to provide more memory
I had this issue a few times. Composer install is mostly working becuase it doesn't have to check every package for updates. To fix this a few options you can try :
update composer to latest
remove the complete vendor folder and run composer update
increase ram memory (most times it fails because of this). Check out this Q Composer update memory limit
Check you composer.json file for unnecessary package depths, some packages require other packages wich can overload your cpu and ram.
Try composer update --prefer-dist
Related
I am try to install barcode package in my cpanel laravel project.But every time it gets killed.
command:
[......#host public_html]$ composer require milon/barcode
after few moment:
Using version ^7.0 for milon/barcode
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
The "http://repo.packagist.org/p/symfony/polyfill-iconv%24535e139d88ce6708c9d8bf795da669c3fe46467f4bc7dc900e2e65a8d77b56ae.json" file could not be downloaded: failed to open stream: Network is unreachable
http://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Killed
it also happening for all the packages I want to install like:pdf or others.Updated my composer.still not working.
It happens for a lack of memory of your server. You can install the package in your local machine then replace your server composer.lock file with the local's composer.lock file Then go to the terminal and run composer update.
I'm running Ubuntu 18.04.4 LTS (Bionic Beaver).
I have installed Composer, Laravel, among other things on this server. I'm trying to run:
composer global require laravel/valet
It attempts to run, and outputs:
Changed current directory to /home/myUser/.config/composer Using version
^2.9 for laravel/valet ./composer.json has been updated Loading
composer repositories with package information Updating dependencies
(including require-dev) Nothing to install or update Generating
optimized autoload files
In ClassMapGenerator.php line 69:
Could not scan for classes inside "database/seeds" which does not
appear to be a file nor a folder
Where is/should this folder be, and why wouldn't it already be there anyway?
Laravel Valet is a MacOS utility, there are linux ports, such as this one, but it won't work on Ubuntu as it uses Homebrew under the hood, a package manager for MacOS.
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 using Laravel Valet to creating laravel application because suddenly composer "create-project --prefer-dist laravel/laravel blog" not working.
require command not working.
so I install the valet
The composer is successfully installed on my device Globally. i Follow stap from laravel valet doc to setup composer.
Problem is after composer require command it takes minimum 5min to load
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
and nothing happened I wait 30min and not error or no output
check images composer installed
again wait for 1hour no output and no error
one more example
now how to fix it
This looks like a network error. You should check your network settings, double check if you have access. (I think you have because you posted this question)
There could also be something wrong with the installed composer repositories. If one of those is unavailable it will take forever to load all repositories/search for a repository. You can check which repositories are used with the following command:
composer -g config repositories
composer config repositories
It solved. It was my broadband problem. The connection was alright but it was not able to download package. now it's working.
I am trying to install zendframework on my windows 7. I have installed wamp and have put ZendFramework-2.2.1_2 folder into wamp/bin/php/php5../ and added path to library in include_path variable of php. now i am trying to use composer to install the project but it is saying that
c:\wamp\www\my_app>cd ZendSkeletonApplication
c:\wamp\www\my_app\ZendSkeletonApplication>php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing zendframework/zendframework (2.2.1)
Downloading: 100%
[UnexpectedValueException]
'C:\wamp\www\my_app\ZendSkeletonApplication\vendor/zendframework/zendframew
ork/bf2ea22d074d758da4b97aae94293c3a.1' is not a zip archive.
The corrupted cache files are the problem.
The solution is to delete the cache files and execute the command again. The cache files are in the composer home directory:
on windows:
C:\Users[user]>\AppData\Roaming\Composer
or
C:\Users[user]\AppData\Local\Composer (I found composer cache files here)
on *nix:
/home/[user]/.composer
on OSX:
/Users/[user]/.composer