我已经安装Laravel使用作曲家没有问题,但当我试图在我的终端执行“Laravel”时,我有这个典型的错误:
-bash: laravel:命令未找到
如果我阅读官方网站的文档,我需要这样做:
确保将~/.composer/vendor/bin目录放在PATH中,这样当您在终端中运行laravel命令时,就可以找到laravel可执行文件。
但我不知道该怎么做。
你能帮我一下吗?谢谢! !
我已经安装Laravel使用作曲家没有问题,但当我试图在我的终端执行“Laravel”时,我有这个典型的错误:
-bash: laravel:命令未找到
如果我阅读官方网站的文档,我需要这样做:
确保将~/.composer/vendor/bin目录放在PATH中,这样当您在终端中运行laravel命令时,就可以找到laravel可执行文件。
但我不知道该怎么做。
你能帮我一下吗?谢谢! !
当前回答
如果你使用的是Ubuntu 16.04。
You need to find the composer config files in my case is : ~/.config/composer or in other cases ~/.composer/ you can see the dir after this command composer global require "laravel/installer" after Laravel Installed you can find your laravel in ~/.config/composer/vendor/laravel/installer/. and you will find the Laravel shortcut command in here : ~/.config/composer/vendor/bin/ set your .bashrc using nano ~/.bashrc and export your composer config file : export PATH="$PATH:$HOME/.config/composer/vendor/bin" or you can use allias. but above solution is recommended. alias laravel='~/.config/composer/vendor/laravel/installer/laravel' Now refresh your bashrc using source ~/.bashrc and then laravel is ready!!
以上步骤适用于我的Ubuntu 16.04
其他回答
使用MacBook时,请参考下面的代码片段;
zsh:
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Bash的:
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
终端类型:
composer global require "laravel/installer"
当作曲家完成时,输入:
vi ~/.bashrc
粘贴并保存:
export PATH="~/.config/composer/vendor/bin:$PATH"
终端类型:
source ~/.bashrc
打开另一个终端窗口,输入:laravel
迟到的回答…
电话1.10.1 2020-03-13 20:34:27 laravel版本—— Laravel安装程序3.0.1
把 导出路径= $路径:~ / config /作曲家/供应商/ bin:美元的道路 在你的~/。ZSHRC或~/.bashrc ~ /来源。ZSHRC或~/.bashrc 这是
将以下内容添加到.zshrc文件中
微,多达/。zshrc或nano~/.zshrc
export PATH="$HOME/.composer/vendor/bin:$PATH"
在文件的末尾。
zsh不知道~,所以用$HOME代替。
来源 ~/.zshrc
完成了!试试命令laravel你就会明白了。
如果你使用的是Ubuntu 16.04。
You need to find the composer config files in my case is : ~/.config/composer or in other cases ~/.composer/ you can see the dir after this command composer global require "laravel/installer" after Laravel Installed you can find your laravel in ~/.config/composer/vendor/laravel/installer/. and you will find the Laravel shortcut command in here : ~/.config/composer/vendor/bin/ set your .bashrc using nano ~/.bashrc and export your composer config file : export PATH="$PATH:$HOME/.config/composer/vendor/bin" or you can use allias. but above solution is recommended. alias laravel='~/.config/composer/vendor/laravel/installer/laravel' Now refresh your bashrc using source ~/.bashrc and then laravel is ready!!
以上步骤适用于我的Ubuntu 16.04