chdir():没有这样的文件或目录(错误号2) [英] chdir(): No such file or directory (errno 2)

查看:545
本文介绍了chdir():没有这样的文件或目录(错误号2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行composer install --working-dir=/path/to/directory

以防万一您想知道:我的硬盘发生故障,因此我需要重新安装作曲器,然后……一切.安装composer之后,使用composer.json文件导航到目录并运行composer install会导致错误,导致composer找不到composer.json文件,因此找不到--working-dir标志.

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.

该项目是Laravel 4.2项目.除了供应商文件夹外,我们所有内容都保存在git repo中.我们以为只要运行composer install,一切都会正确-的确如此.

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.

我运行composer install --verbose并收到以下消息:

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.

推荐答案

事实证明,主要问题是gitbash的起始目录.

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

安装后,我将起始目录更改为c:\users\[me]\My Documents

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

即使该目录包含子目录,我也可以cd进入子目录;运行ls会产生0个结果.

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

我最终将起始目录更改为c:\users\[me]\Documents,并且一切正常. Composer找到了composer.json文件,所有其他命令均起作用.经验教训.

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.

这篇关于chdir():没有这样的文件或目录(错误号2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆