1

I'm getting the above error when running composer install --working-dir=/path/to/directory

In case you're wondering: I had a hard drive failure so I needed to re-install composer and well... everything. After installing composer, navigating to the directory with the composer.json file and running composer install would result in an error that composer couldn't find a composer.json file, hence the --working-dir flag.

The project is a Laravel 4.2 project. We have everything in a git repo with the exception of the vendor folder. We figured we would just run composer install and all would be right in the world - and it was.

I ran composer install --verbose and received the following:

Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:149
 Composer\Util\ErrorHandler::handle() at n/a:n/a chdir() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:149
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:25

Any ideas would be appreciated. Not sure why I'm suddenly having these problems. A week or two ago a co-worker was able to run all of the same steps without error.

gin93r
  • 1,551
  • 4
  • 21
  • 39

1 Answers1

1

As it turns out, the main problem was the starting directory of gitbash.

When I installed it, I changed the starting directory to be c:\users\[me]\My Documents

Even though this directory had sub-directories, and I could cd into them; running an ls would produce 0 results.

I ended up changing the starting directory to c:\users\[me]\Documents and everything worked fine. Composer found the composer.json file and all other commands worked. Lesson learned.

gin93r
  • 1,551
  • 4
  • 21
  • 39