0

I'm trying to get Composer to install on Babun locally on a Windows 10 machine but it refuses to run except when the CWD is the location of the composer.phar file. In other words, I cannot run Composer globally.

Following is my terminal

{ ~ }  » alias composer="/usr/local/bin/composer.phar"
{ ~ }  » ls -la /usr/local/bin/composer.phar
-rwxr-xr-x+ 1 kschr kschr 1816271 Feb  9 12:38 /usr/local/bin/composer.phar
{ ~ }  » composer
Could not open input file: /usr/local/bin/composer.phar
{ ~ }  » php /usr/local/bin/composer.phar
Could not open input file: /usr/local/bin/composer.phar
{ ~ }  » which composer.phar
/usr/local/bin/composer.phar
{ ~ }  » cd /usr/local/bin
{ bin }  » php ./composer.phar
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/

What in the world is going on here? I'm pretty sure it's a Babun/Windows paths thing since I have no problem running Composer anywhere else, but I don't know exactly what.

dreftymac
  • 31,404
  • 26
  • 119
  • 182
Kevin Schroeder
  • 1,296
  • 11
  • 23

2 Answers2

1

I had a similar problem. The thing is, that in C:\ProgramData\ComposerSetup\bin\composer (that's a bash file) there is a check if the path starts with /cygdrive/* and if it does (and only then) it converts the paths to windows paths.

So for me all I needed to do is change my path from /c/php-7.1.8 to /cygdrive/c/php-7.1.8. Since then I can run composer without a problem.

Hope this helps.

0

I had a similar issue with Symfony, in the end I did php "C:\Users\[username]\.babun\cygwin\usr\local\bin\symfony" and that worked, you could try the same with composer - I found putting the quotes around the path made the main difference. It does seem to be to do with Babun/Windows paths though.

Joe Keene
  • 2,175
  • 21
  • 27