Reputation: 3552
In a tutorial, after installing Composer like this :
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
It recommends to do this change to shell configuration, so that Composer can install commands within the user account:
sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
But in my case, in $HOME/.composer/
I DO NOT have a vendor
folder. There's only a .htaccess
file and a cache
folder.
What's wrong? Is it because of a new version of Composer?
Upvotes: 1
Views: 3844
Reputation: 57683
This is when you don't have any packages installed globally (see Composer documentation for more info about global packages). These global packages are installed to $HOME/.composer/vendor/
and some might have a binary which would install into $HOME/.composer/vendor/bin
.
To be able to run these binaries from any of your Composer projects it needs to be in your PATH
:
sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
So nothing is wrong. Just add this folder to your PATH
. It should be no problem if this folder doesn't exist yet. It will be automatically created as soon as you install a global package with binaries (see example below).
An example for a package which is a good idea to install globally instead of your projects folder is PHPUnit (a PHP Testing Framework). You can install it with
composer global require "phpunit/phpunit=5.0.*"
If you have a look into your $HOME/.composer/vendor/
you will recognize a phpunit
folder and also a bin
folder.
Upvotes: 2