0

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

ryanadhi
  • 67
  • 1
  • 8
  • What have you tried to debug the problem? According to that output of `composer global require`, nothing has been installed – Nico Haase Jun 01 '20 at 17:04
  • It was my second trial, that's why nothing has been installed/updated. the first one shows the installation completed – ryanadhi Jun 02 '20 at 03:10
  • Does this answer your question? [Laravel PHP Command Not Found](https://stackoverflow.com/questions/26376516/laravel-php-command-not-found) – D Malan Jun 02 '20 at 11:58

4 Answers4

3

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" 
CognitiveRobot
  • 1,337
  • 1
  • 9
  • 26
TeemO
  • 31
  • 2
2

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.

D Malan
  • 10,272
  • 3
  • 25
  • 50
0

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

Andy
  • 61
  • 5
0

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hondaman900
  • 109
  • 2
  • 14