如何将 ~/.composer/vendor/bin 目录放在 PATH 中? [英] How to place the ~/.composer/vendor/bin directory in your PATH?
问题描述
我使用的是 Ubuntu 14.04,我一直在尝试所有可能的方法来安装 Laravel,但无济于事.错误消息我尝试的一切.我现在正在尝试快速入门文档中的第一种方法,即通过 Laravel 安装程序,但它说确保将 ~/.composer/vendor/bin
目录放在你的 >PATH
以便在终端中运行 Laravel 命令时找到 Laravel 可执行文件."所以我的问题是,我该怎么做?这可能是一个简单的问题,但我真的很沮丧,希望得到任何帮助.
I'm on Ubuntu 14.04 and I've been trying all possible methods to install Laravel to no avail. Error messages everything I try. I'm now trying the first method in the quickstart documentation, that is, via Laravel Installer, but it says to "Make sure to place the ~/.composer/vendor/bin
directory in your PATH
so the Laravel executable is found when you run the Laravel command in your terminal." so my question is, how do I do that? This may be a simple question but I'm really frustrated and would appreciate any help.
推荐答案
把这个文件夹放到PATH环境变量类型
To put this folder on the PATH environment variable type
export PATH="$PATH:$HOME/.composer/vendor/bin"
这会将文件夹附加到您现有的 PATH,但是,它仅对您当前的终端会话有效.
This appends the folder to your existing PATH, however, it is only active for your current terminal session.
如果您希望它自动设置,则取决于您使用的外壳.对于 bash,您可以使用您喜欢的编辑器将此行附加到 $HOME/.bashrc
或在 shell 上键入以下内容
If you want it to be automatically set, it depends on the shell you are using. For bash, you can append this line to $HOME/.bashrc
using your favorite editor or type the following on the shell
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
为了检查它是否有效,请注销并重新登录或执行
In order to check if it worked, logout and login again or execute
source ~/.bashrc
在外壳上.
PS:对于其他没有~/.bashrc
的系统,也可以把这个放到~/.bash_profile
PS: For other systems where there is no ~/.bashrc
, you can also put this into ~/.bash_profile
PSS:对于较新的 Laravel,您需要将 $HOME/.config/composer/vendor/bin
放在 PATH
上.
PSS: For more recent laravel you need to put $HOME/.config/composer/vendor/bin
on the PATH
.
PSSS:如果你想把这个文件夹也放在其他 shell 或 GUI 的路径上,你应该将上述 export
命令附加到 ~/.profile
(参见https://help.ubuntu.com/community/EnvironmentVariables).
PSSS: If you want to put this folder on the path also for other shells or on the GUI, you should append the said export
command to ~/.profile
(cf. https://help.ubuntu.com/community/EnvironmentVariables).
这篇关于如何将 ~/.composer/vendor/bin 目录放在 PATH 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!