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.


当前回答

详细说明:

在你的~/。Bashrc添加这些行:

export PATH="$PATH:~/.composer/vendor/bin"

然后重新加载:

source ~/.bashrc

检查是否正确添加:

echo $PATH

/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/web/bin:~/.composer/vendor/bin

其他回答

MacOS Sierra用户:

如果您的计算机上已经安装了MAAP,请确保从应用程序文件夹中删除MAAP和MAAP Pro

在根目录CD ~ 检查自制软件(如果你安装了自制软件)或者更新PHP

酿造安装php70

export PATH=“$PATH:$HOME/.composer/vendor/bin”

>> ~/.bash_profile . echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"

源~ / . bash_profile

猫. bash_profile

确保这是显示: 导出路径= " $路径:$ HOME / .composer /供应商/ bin”

拉拉维尔

现在它应该是全球性的

在Yosemite (OS X 10.10.5)上设置PATH,使用下面的命令:

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile

重新加载退出终端并重新启动或使用:

source ~/.bash_profile

帮助了我,希望它能帮助其他人!

我的路径没有/.composer,只有/composer,所以我的路径是:-

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

这在ubuntu 20.04上对我有效

Composer bin目录被设置并存储在bin-dir配置变量中,根据您的设置可以有所不同。运行命令composer global config bin-dir——absolute会告诉你全局composer bin目录的绝对路径。使用这个命令,您可以修改.bash_profile,将其完全按照配置的方式添加到PATH中。

# Add Composer bin-dir to PATH if it is installed.
command -v composer >/dev/null 2>&1 && {
        COMPOSER_BIN_DIR=$(composer global config bin-dir --absolute 2> /dev/null)
        PATH="$PATH:$COMPOSER_BIN_DIR";
}
export PATH

如果有人使用ZSH,所有步骤都是一样的,除了几件事:

找到文件。zshrc 在底部添加以下一行export PATH=~/.composer/vendor/bin:$PATH 源~ / . zshrc

然后试试男仆,如果问密码,那么一切都ok。