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.


当前回答

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

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

其他回答

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

对于Linux Mint 18:编辑~/。Bashrc并在底部添加这一行:

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

然后resource .bashrc(在控制台中输入):

source ~/.bashrc (or close and reopen the terminal)

通过在控制台中输入测试它:

echo $PATH

或者输入console:

laravel

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

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

这在ubuntu 20.04上对我有效

要解决这个问题,请确保您找到了作曲家的路径。phar第一

我的例子是这样的

alias composer="php /Users/Your-username/composer.phar"

进入cd Users >您的用户> Command ls,查看composer. sh是否存在。Phar在那里,如果是,然后将上面的行添加到.bash_profile。请确保将用户名更改为您自己的用户名。

希望这能帮到你

在Fedora:

有些composer bin不在.composer目录中 所以你需要使用以下方法来定位它们:

locate composer | grep vendor/bin

然后在.bashrc中回显该部分

echo 'export PATH="$PATH:$HOME/{you_composer_vendor_path}"' >> ~/.bashrc

我的是"/.config/composer/vendor/bin" 干杯!