laravel command not found setting path does not work

Viewed 19705

I am have installed laravel via composer using the following procedure in my Ubuntu 17.04 running on the latest Oracle Virtualbox:

Steps:

1) composer global require "laravel/installer"

2) nano .bashrc

3) I added export PATH="$PATH:$HOME/.composer/vendor/bin"

4) saved changes.

I even added this line to .profile logged out then back in again but I am still getting laravel command not found.

What am I doing wrong?

8 Answers

I had the same problem with my Linux Mint. Check the composer folder path if this in ~/.config/composer then you need to change the $PATH variable looks like below. This should solve the problem:

  1. nano .bashrc [ or nano .bash_profile ]
  2. export PATH=~/.config/composer/vendor/bin:$PATH [ Add this line and save it ]
  3. source .bashrc

You need to edit bash_profile

nano ~/.bash_profile 

Copy/paste

export PATH=~/.composer/vendor/bin:$PATH

Then run

source ~/.bash_profile

Now you can use laravel command in your Terminal

You need to edit your .bashrc
nano ~/.bashrc

add this line
export PATH=$HOME/.config/composer/vendor/bin:$PATH

save and exit then close your terminal and reopen it run:
laravel

If you receive this error, then there is issue with the path.You have to edit the .zshrc file and add this line

To edit the file run following command from terminal

nano ~/.zshrc

then enter this line inside that file

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

enter image description here

To save press Control + X buttons.

Then press Y to save and Hit enter.

sometimes if you have duplicate paths it may bring errors

Big thanks to NILESH SHIRAGAVE https://snilesh.com/blog/solved-zsh-command-not-found-laravel/

Related