![]() |
| Photo by Glenn Carstens-Peters on Unsplash |
When i start to migrating from Windows to Linux (i am using Ubuntu 18.04) i have to install everthing including Laravel. So i installed the Laravel globally using composer
everything went ok. Then i found problem when i want to make a project named "perpus" using command
The error says : "laravel : command not found". Then i checked what the official website says :

"Make sure to place Composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; however, some common location inceelude : GNU / Linux Distributions : $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin"
So we have to check our Composer PATH location and Linux's Bash to make sure there are in the same location. First, open the terminal and type
we can see my Composer PATH located in /.composer/vendor/bin, then we must check do Bash locating the PATH in the same place by type "echo $PATH"
What written in my Bash is /.config/composer/vendor/bin, that's why laravel command not found because the PATH location between Composer's setting and Bash are different. So we have to edit PATH on the Bash to change it permanently. Actually you can use one step by export command but it's not change permanently, that's why i prefer to edit it. To start edit, open Bash file by typing :
The editor will be appear, scroll at the last of content, and then we can find text
PATH=$PATH:$HOME/.config/composer/vendor/binexport PATH
edit the PATH into "$HOME/.composer/vendor/bin". Save and close the editor. We need to run the current command by type
then we can check again by type "echo $PATH"
We can see now we have a new PATH located in /.composer/vendor/bin. But why the old PATH (/.config/composer/vendor/bin) is still there? Don't worry, it will disapear when you close the terminal and echo the PATH again.
Now we can test the laravel command by go to our web localhost directory and type laravel on the terminal
Tara! now we can use laravel command anytime




Komentar
Posting Komentar