Where is composer installed on Windows?

Where is my composer installed on Windows 10? Very likely, you will ask this question after you download composer and install it on your system, because the installer does not ask you for installation directory. During installation, it only asks you for the location of php.exe, and lets you check on a checkbox(I am also confused about that checkbox). That is not the composer installation path. In fact, you cannot install composer to specific path, and you almost cannot guess the composer location on windows. It is not the usual app installation folder C:\Program Files or C:\Program Files (x86). It is not any folder related to php installation directory. The composer install directory is C:\ProgramData\ComposerSetup. You cannot choose to install composer to different directory. Interesting enough, err?

Ok, let’s forget where composer is installed, and go on to install packages using composer. You are told to open a new cmd window and run command like:

composer require xxx/yyy

Things seem to go well, and you see composer is busy in downloading packages and installing them. But where does composer install packages? The composer command does tell you where it stores files. Are the packages installed to where php is installed like pip in python?  You search the php folder but cannot find any installed packages. Where does composer install files? You may not believe composer installs packages in your current directory. Two files composer.json and composer.lock and one directory vendor will appear in your current directory and every package has a sub-directory under the vendor directory. When you open the cmd window, the current directory may be c:\Users\myprogrammingnotes.com\, and composer has installed packages to that directory. That is almost not what you want. You want composer to install package to specific directory. Then, what’s left for you is to remove all packages you just installed and cd to the correct working directory and install those packages again.

How to let composer remove all packages? You are told to remove a package using:

composer remove xxx/yyy

This command will not only remove the package xxx/yyy, but also remove multiple packages that xxx/yyy depends on. But it will leave the file composer.lock, composer.json, the directory vendor and some sub-directories in vendor like composer and bin un-removed. You can just delete all files/directories vendor composer.lock composer.json to uninstall all packages, then switch to proper location to install the packages again.

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Leave a Reply