Astra
August 10, 2023, 7:41am
1
I was installing laravel and its composer on my distro and after some time my commands didn’t work
[diyash@diyash-nitroan51555 ~]$ sudo pacman -S php
bash: sudo: command not found
[diyash@diyash-nitroan51555 ~]$ systemctl reboot
bash: systemctl: command not found
[diyash@diyash-nitroan51555 ~]$ pacman -S sudo
bash: pacman: command not found
None of them are working
Did you mess up your PATH variable during the installation process?
What does echo $PATH
return?
Astra
August 10, 2023, 8:21am
3
Yeah i messed it up but now its done
But now I have something else isuue i have installed laravel as global but it’s still saying
[diyash@diyash-nitroan51555 ~]$ laravel -v
bash: laravel: command not found
Can u hwlp me with it
You mean you set your PATH variable back? And all the other commands are available now?
First, tell me how you installed laravel? From the AUR?
Astra
August 10, 2023, 8:24am
7
Like this
php -r “copy(‘https://getcomposer.org/installer ’, ‘composer-setup.php’);”
php composer-setup.php
php -r “unlink(‘composer-setup.php’);”
sudo mv composer.phar /usr/local/bin/composer
composer global require laravel/installer
Please help me with it
Try this. On the terminal, run:
export PATH=/usr/local/bin/composer:$PATH
After that, try to run laravel
again.
Astra
August 10, 2023, 8:28am
9
[diyash@diyash-nitroan51555 ~]$ export PATH=/usr/local/bin/composer:$PATH
[diyash@diyash-nitroan51555 ~]$ laravel -v
bash: laravel: command not found
You need to first track down where the laravel
binary is. Run:
$ sudo find / -name "laravel"
Astra
August 10, 2023, 8:34am
11
not working its taking too muchh time
Astra
August 10, 2023, 8:35am
12
I have set my nano ~/.basgrc like this
PATH=~/.console-ninja/.bin:$PATH
export PATH=“/usr/bin:$PATH”
export PATH=“$PATH:$HOME/.composer/vendor/bin”
is this okay
You don’t need to modify your PATH so many times. Like I said, you have to find out where the laravel
executable file is located.
Why are these two lines needed?
Check inside ~/.composer/vendor/bin
directory. If laravel
is inside that directory, then all you need is this inside your bashrc:
export PATH="$HOME/.composer/vendor/bin:$PATH"
Astra
August 10, 2023, 8:39am
14
then which should i delete
Do you see an executable file called laravel
inside ~/.composer/vendor/bin
?
Then delete all three of these lines in your .bashrc and replace them with:
export PATH="$HOME/.composer/vendor/bin:$PATH"
Launch a new terminal window. It should work now.
Astra
August 10, 2023, 8:44am
18
Nope man still not working
[diyash@diyash-nitroan51555 ~]$ laravel -v
bash: laravel: command not found
How is that possible? You just told me that there is an executable laravel
inside ~/.composer/vendor/bin
and we’ve just set the PATH to include that directory.
Did you run the command in a new terminal window? .bashrc has to be sourced first so that the new PATH takes effect.
1 Like
Astra
August 10, 2023, 8:51am
20
Just Chill man now its finally working
Many Thanks to You for helping me to sort out the Issue
Have a great day man