Command not found Issue

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?

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?

Yes its available now

First, tell me how you installed laravel? From the AUR?

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.

[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"

not working its taking too muchh time

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"

then which should i delete

Do you see an executable file called laravel inside ~/.composer/vendor/bin?

yes

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.

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

Just Chill man now its finally working
Many Thanks to You for helping me to sort out the Issue
Have a great day man