PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 7, 2022

[FIXED] chdir(): No such file or directory (errno 2)

 January 07, 2022     composer-php, laravel-4     No comments   

Issue

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.


Solution

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.



Answered By - gin93r
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing