Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composer update -vvv is not working

I have installed composer globally on ubuntu 14.04. When I run composer --version it works with the following output

Composer version 1.0-dev (45b1f356c24d87788a339f6a50d6d78bef464c47) 2015-02-27 14:31:27

But when I run the following command composer update -vvv

It gives the following error

Failed to initialize global composer: Composer could not find the config file: /home/enamul/.composer/composer.json
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section

I have no idea, why this is happening. Can anyone help me with that.

Thanks

like image 510
ehp Avatar asked Feb 28 '15 18:02

ehp


People also ask

How do I update the composer to the latest version?

update / u# In order to get the latest versions of the dependencies and to update the composer. lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.

Why does composer update takes so long?

Composer update is very slow if you have a lot of dependencies/packages implemented. You should avoid variable versions and think about using a HHVM as server.

How do I increase composer memory limit?

Use the format “128M” for megabyte or “2G” for gigabyte. You can use the value “-1” to ignore the memory limit completely. Another way would be to increase the PHP memory limit: php -d memory_limit=512M composer.


2 Answers

Just put an empty JSON object into your global config.

echo "{}" > ~/.composer/composer.json

Composer will merge this configuration with your project's composer.json when you run the install and update commands.

From the docs https://getcomposer.org/doc/03-cli.md#composer-home

like image 105
everyman Avatar answered Oct 06 '22 01:10

everyman


To debug this, you should do on the command line:

cd /opt/lampp/htdocs/myproject
ls -al
cat composer.json

All these commands should show the expected thing. I'd expect the directory listing to show the composer.json file being present and having correct access rights for the user you are running as.

composer update

I have no idea why composer would ever fail, but from my experience it does a pretty good job doing what its supposed to do. Failure usually is caused by minor oversights of obvious things.

like image 39
Sven Avatar answered Oct 05 '22 23:10

Sven