Oliver Williams
Oliver Williams

Reputation: 6384

successful install of composer, but message shows: The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly

I have installed composer on a Ubuntu vagrant box, running php 7.0 (which was just installed prior to this). Trying simply composer, or the full path php /usr/local/bin/composer both result in the following error:

The HOME or COMPOSER_HOME environment variable must be set for 
composer to run correctly

I am unfamiliar with which env variable to set (or both), what value it should be set to, or where it should be set/declared! I've searched quite a few forums including github, but I'm not seeing this information. Appreciate your help.

error after composer install

UPDATE: Also tried this, same message:

curl -sS https://getcomposer.org/installer | php

Upvotes: 15

Views: 22319

Answers (1)

Oliver Williams
Oliver Williams

Reputation: 6384

The following worked for me, successfully allowing me to see the composer output:

export COMPOSER_HOME="$HOME/.config/composer";
composer

Note that I was able to just run composer in the project folder, didn't need to use the full path.

REFERENCE: https://github.com/consolidation/cgr/issues/10

(javi-dev commented on Feb 24)

Upvotes: 30

Related Questions