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

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.
UPDATE: Also tried this, same message:
curl -sS https://getcomposer.org/installer | php

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)

Related

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

i just wanted to install the newest Shopware version 6.4.16.1 and i get this failure:
The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
i have composer installed and the home and composer_home variables are available on the server. what am i doing wrong? i have never got any error like that
This is indeed a known issue, which was fixed in the upcoming v6.4.17.0 release, see the official ticket.
A workaround for now would be to add a .env in the root directory with following content:
COMPOSER_HOME="/var/cache/composer"
If you already have a .env there just add that line.

Failed to initialize global composer: mac /Sites

Trying to view a local website:
"Uncaught Error: Class 'ComposerAutoloaderInite0e6765..etc' not found in /Users/{ username }/Sites/{ sitename }/htdocs/vendor/twig-autoload.php".
So on into Terminal to do composer dump-autoload. (It worked the first time I did it).
I now get this message:
"The 'git' command requires command line developer tools. Would you like to install the tools now?" (It asks for Xcode)
I click No.
Terminal tells me the file command has been run OK, but no...
Repeating the dump autoload with -vvv reveals the truth:
Failed to initialize global composer: Composer could not find the config file: /Users/{ username }/.composer/composer.json
Searching about, the only things I've found on the composer error seem to be related to Lavarel.
info:
Composer is installed in /Sites/{ sitename }/vendor/
Composer version: 1.10.6
So what I'd like to understand:
Why is composer trying to initialise a 'global composer'? Does it think the locally installed one is global, or could there be another Composer it's trying to default to?
How do I tell composer where the json file is?
What should I do about the xCode message, if anything?
I've reinstalled composer (and Twig - the only package I'm using - seems overkill for one package, but trying out alternatives didn't end well).
The site is now back running (locally).
Still have the issue of xCode request from Terminal, but that's for another question.
So the answer seems to be: Reinstall composer and packages.

Can't execute composer.phar in shared hosting

I've installed Composer on a shared-host (hostgator) following this guide:
https://laravel.io/forum/02-13-2014-how-to-install-laravel-on-a-hostgator-shared-server
It was installed using this command:
curl -sS https://getcomposer.org/installer | php
When I try to run composer I get the message "/home2/georger/composer.phar: no such file or directory" although the file does exist, I can open it. Other questions that deal with this suggest moving it to /usr/local/bin but that's not an option for me.
As outlined in the installation instructions, you will need to pass it to the php interpreter:
$ php composer.phar
Alternatively, you might want to reconsider whether you really want to execute composer in a production environment or rather execute it during the deployment and then deploy the artifacts. In other words, you probably want to run composer install on the machine from which you want to deploy to the production system, and then synchronize files from there to the production system, for example, using rsync.
For reference, see https://getcomposer.org/doc/00-intro.md.

Can't find /root/.composer/vendor/bin/laravel: No such file or directory

I have installed composer on Centos 7 virtualbox with PHP 5.6.27. I will show the commands that I have used and the issues that I am now having. I should first say that all of these commands have worked on previous installations.
Okay so for starters here is what I used to install composer.
curl -sS https://getcomposer.org/installer | php
Followed by
mv composer.phar /usr/local/bin/composer
Now I am trying to install laravel via the commands listed below.
composer global require "acacha/adminlte-laravel-installer=~3.0"
Up to this point all of the commands listed above have successfully worked.
Now here is the current problem. When I try to run the following command I get an error.
laravel new laravel-with-admin-lte
-bash: /root/.composer/vendor/bin/laravel: No such file or directory.
I have tried a whole set of remedies for this message but it cannot find the .composer directory. Can anyone tell me where the correct .composer directory is and how I can modify it so that it looks to the proper location to finalize this installation?
I appreciate any solutions that you can provide me. I have struggled with this for two days straight and have googled everything under the sun. Hopefully, someone on here has had a similar solution with a valid resolution.
Put an alias to the freshly installed Laravel installer in your user configuration .bashrc:
nano ~/.bashrc
And place this inside the file:
alias laravel='~/.config/composer/vendor/bin/laravel'
And run the following to make sure your bashrc profile is reloaded:
source ~/.bashrc
laravel new project
download as superuser
download installer
sudo composer global require "laravel/installer=~1.1"
setting up path
export PATH="~/.composer/vendor/bin:$PATH"
check laravel command
laravel
I had the same problem, so I changed the directory.
This is the directory where your bash was created: /root/.config/composer
enter image description here
but when excute the laravel command, the system search en the directory : bash: /root/.composer/vendor/bin/laravel:
enter image description here
So, just you need to change the address /root/.config/composer/vendor to /root/.composer/vendor.
PD. sorry I am learning english, so it is a little bad.

Composer returning question marks

My mac is installed with composer and it works fine. I then clone a laravel project. When I run composer update, some of the dependencies require some php stuff to be downloaded first, like php53-mcrypt. After installing the php stuff, i ran composer update again, it returns a bunch of question marks. A bit of googling returns me answers that require to set the
detect_unicode=Off
in the php.ini. Set it off but still the same. Reinstall composer with the following command
curl -s getcomposer.org/installer | php -d detect_unicode=Off
Still the same. Anyone can help?
Apparently, I had to make sure I added the detect_unicode = off in the correct php.ini file. Reinstall composer with homebrew again and it works.

Resources