Last updated: Apr 4, 2024
Reading time·4 min
The error "'composer' is not recognized as an internal or external command, operable program or batch file" occurs for 2 main reasons:
composer
executable in your system's PATH
environment variable.To install and configure Composer on Windows:
php
is installed on
your machine.You might also have to restart your PC, but that's not always necessary.
In a new Command Prompt, issue the composer -V
command to verify the
composer
executable is available.
composer -V composer
If you still get the "'composer' is not recognized as an internal or external
command, operable program or batch file" error, we have to add the path to the
composer
executable to your system's PATH environment variable.
The path to the composer
executable on my machine is the following.
C:\ProgramData\ComposerSetup\bin
We are looking for the directory that contains the composer.bat
file.
To add the path to the composer
executable in your system's PATH environment
variable:
The path on my machine is the following.
C:\ProgramData\ComposerSetup\bin
We are looking for the directory that contains the composer.bat
file.
composer
executable file, add it and click
on the "OK" button twice.You might also have to restart your PC, but that's not always necessary.
Open a new Command Prompt and run the composer -V
command to make sure the
composer
executable is accessible.
composer -V composer
If you still get the error, you have to add the .PHAR
extension to your
PATHEXT
system environment variable.
;.PHAR
to the end of the value of the environment variable.Once you add ;.PHAR
to the end of the PATHEXT
system environment
variable, click on "OK" twice to confirm.
Close your Command prompt application and then reopen it.
You might also have to restart your PC, but that's not always necessary.
Open a new Command Prompt and run the composer -V
command to make sure the
composer
executable is accessible.
composer -V composer
If the error persists, try restarting your PC to make sure you don't have any
stale CMD, PowerShell or IDE sessions and rerun the composer -V
command.
To solve the "'composer' is not recognized as an internal or external command, operable program or batch file" error, make sure:
composer
executable in your system's PATH
environment variable.You can learn more about the related topics by checking out the following tutorials: