I don't know if this question has been asked, because searching finds results mostly about moving the libraries installation directory.
我不知道是否有人问过这个问题,因为搜索查找的结果主要是关于移动库安装目录的。
I have a globally installed composer command. Is there a way to run, for example, composer install
in a different directory than current, i.e. to specify the directory in which I would like tu run the command?
我有一个全球安装的composer命令。是否有一种方法可以运行,例如,将composer安装在与当前目录不同的目录中,例如,指定我希望您运行该命令的目录?
E.g. being in /home/someuser
, I would like to acquire the same result as in running composer install
it inside /home/someuser/myproject
. Of course, one way would be to simply change the current directory, run composer and go back.
例如,在/home/someuser中,我希望获得与运行composer时相同的结果,并将其安装在/home/someuser/myproject.中当然,一种方法是简单地更改当前目录、运行composer然后返回。
2 个解决方案
#1
68
Sure, try composer install -h
. There you'll find option --working-dir
(or -d
). And that's what you're looking for.
当然,请尝试安装-h。在那里,您将找到选项——workdir(或-d)。这就是你要找的。
Then run:
然后运行:
composer install -d=/home/someuser/myproject
You can find more in composer docs.
你可以在作曲家文档中找到更多。
#2
6
In addition to the above answer from Tomáš Votruba i had to append the = charachter on OSX. So the full command would be:
除了上述答案TomašVotruba我不得不追加= charachter OSX。所以完整的命令是:
composer install -d=/home/someuser/myproject
My first post on SO so was unable to simply add this as a comment.
我在SO上的第一篇文章不能简单地加上这句话作为评论。
#1
68
Sure, try composer install -h
. There you'll find option --working-dir
(or -d
). And that's what you're looking for.
当然,请尝试安装-h。在那里,您将找到选项——workdir(或-d)。这就是你要找的。
Then run:
然后运行:
composer install -d=/home/someuser/myproject
You can find more in composer docs.
你可以在作曲家文档中找到更多。
#2
6
In addition to the above answer from Tomáš Votruba i had to append the = charachter on OSX. So the full command would be:
除了上述答案TomašVotruba我不得不追加= charachter OSX。所以完整的命令是:
composer install -d=/home/someuser/myproject
My first post on SO so was unable to simply add this as a comment.
我在SO上的第一篇文章不能简单地加上这句话作为评论。