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.


当前回答

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

为我工作。

其他回答

对我来说,在Ubuntu 22.04中,这是可行的:

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

这是用于在Mac OS X 10.9.5版本上设置PATH。

我已经尝试添加$HOME,因为我使用用户配置文件:

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

当您不使用用户配置文件时:

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

然后重新加载:

source ~/.bashrc

我希望这对你有帮助。

详细说明:

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

我做了以上所有的事情,但它对我不起作用。

我只是把这个复制到我的终端,它为我工作。

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

我尝试了很多解决方案,但在Ubuntu 20.04上只有这个对我有效:

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