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

其他回答

添加export PATH="$PATH:~/.composer/vendor/bin"到~/。Bashrc适用于您的情况,因为只有在运行终端时才需要它。 为了完整起见,将它附加到/etc/environment中的PATH (sudo gedit /etc/environment并在PATH中添加~/.composer/vendor/bin)即使被其他程序调用也可以工作,因为它是系统范围的环境变量。 https://help.ubuntu.com/community/EnvironmentVariables

详细说明:

在你的~/。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

打开Mac终端:

vi ~/.bashrc

如果你没有使用过vi,一开始看起来可能有点滑稽,所以仔细输入以下代码,按顺序:

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

按ESC

:
w

按回车键

:
q

按回车键

现在您应该已经返回到正常的终端视图。

检查编写器现在有正确的路径:

cd ~/.composer
echo $PATH

如果您看到包含您的文件目录的路径(例如/Users/JeffStrongman/.composer/vendor/bin),那么您就可以开始了。

cd

然后运行安装。我在配置我的Mac使用Laravel Valet时遇到了这个问题。

示例(可选)

valet install

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

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

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

AWS Ubuntu 18.04 LTS

Linux ws1 4.15.0-1023-aws #23-Ubuntu SMP Mon Sep 24 16:31:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc && source ~/.bashrc

为我工作。