2

After I am using

composer global require laravel/installer

it seems the installation is success. For the second time, the result is:

Changed current directory to /home/ryanadhi/.config/composer
Using version ^3.1 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

then if I do

echo $PATH

the result is

    ~/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/ryanadhi/go/bin:/home/ryanadhi/.composer/vendor/bin

However if I try

laravel

the result is always:

laravel: command not found

3
  • What have you tried to debug the problem? According to that output of composer global require, nothing has been installed Commented Jun 1, 2020 at 17:04
  • It was my second trial, that's why nothing has been installed/updated. the first one shows the installation completed Commented Jun 2, 2020 at 3:10
  • Does this answer your question? Laravel PHP Command Not Found Commented Jun 2, 2020 at 11:58

6 Answers 6

5

Editing the ~/.bashrc in Ubuntu 20.04 to reflect the path shown in the "Changed current directory to /home/ryanadhi/.config/composer" , message. fixed this for me.

first


 gedit ~/.bashrc

then edit the line

export PATH="/home/ryanadhi/.config/composer/vendor/bin:$PATH" 
Sign up to request clarification or add additional context in comments.

1 Comment

I had to execute source ~/.bashrc after changing ~/.bashrc
3

You need to add /home/ryanadhi/.config/composer/vendor/bin to your path.

The output that said "Changed current directory to /home/ryanadhi/.config/composer" means that /home/ryanadhi/.config/composer is your Composer global directory.

2 Comments

my path written like this /home/ryanadhi/.composer/vendor/bin so it is not correct?
Nope, it is not.
2

For Mac users:

composer global require laravel/installer
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

laravel

1 Comment

This worked on my Mac, Thank you!
1

If your still having issues running the laravel command you can symlnk laravel to /usr/local/bin/

Use this command:

ln -s ~/.composer/vendor/laravel/installer/bin/laravel laravel

Worked for me

Comments

1

I had to do two things, first I needed the "~" in front of the path in the bashrc file. My path line was:

export PATH="~/home/stephen/.config/composer/vendor/bin:$PATH"

and I had been putting "sudo" in front of "laravel new..." command which didn't work.

With those changes it installed as expected.

Comments

-2

On Windows 11, I resolved this by running composer global require laravel/installer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.