Saturday, January 1, 2022

[FIXED] Has composer global path changed (from 1.x to 2.0)

Issue

I recently upgraded composer to the new version (on a Ubuntu 18.04 machine) and everything seemed to work fine until I tried to composer global require a package. It was installed correctly but when I tried to call it, my bash says command not found (I had some globally installed packages before and they were working as expected)

After some digging, I found that my new package was not installed in $HOME/.composer/vendor/bin (this was part of my $PATH) but rather in $HOME/.config/composer/vendor/bin.

My question is : does the new version use a different directory for installing global packages (I couldn't find anything in the docs or any other online resource about that) or is something wrong with my setup ? (if so how can I track it down ?)


Solution

One way to find out would be using the config command:

composer global config --list and look for bin-dir

Or as a one liner if you prefer: composer global config --list | grep bin-dir



Answered By - Manuel Garcia

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.