Laravel: command not found

I feel like a moron for what I have to ask about it, and I went through all such questions to no avail. I am running Ubuntu 14.04 on vagrant vm on mac. I have a composer installed and I have executed the following commands:

composer global require "laravel/installer" 

(this seems to have worked and shows that laravel is one of the things that were downloaded)

I also added this line to .bashrc

 export PATH="โˆผ/.composer/vendor/bin:$PATH" 

Notice, I added this to both the roaming user and the root user .bashrc file. I logged out and returned to the shell and checked the path with this command:

 echo $PATH 

What gives me this:

~ / .composer / vendor / bin: ~ / .composer / vendor / bin: / USR / local / SBIN: / USR / local / bin: / USR / SBIN: / USR / box: / SBIN: / bin: / USR / games: / usr / local / games

and the team that fails is

 laravel new test 

I donโ€™t see what I can lose, any ideas?

+5
source share
7 answers

Better use $HOME instead of ~ .

In my .zshrc (I use zsh ) I work this way

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

Make sure that your terminal really uses .bashrc and there cannot be .bash_profile , if so, you should edit this file. If you use it from a virtual machine, the user you log in with when calling vagrant ssh is vagrant , not root .

Also, do not forget to upload the file after editing or open a new terminal.

UPDATE

I see that there are answers that put the $PATH path after the composer, so I thought I could tell you what I learned to be the difference.

This is not a random thing that you can put as you want. What you put after rewriting what was before .

This means that if you have something installed on your system and you install a newer version of the package using the composer, it will have the same command as if the composer's path does not follow the path to the system, you will need to specify the full path to the vendor/bin binary inner composer in order to execute it.

+32
source

If you place the tilde (~) inside quotation marks, it will not be transferred to your home directory. Run this and it should work:

 export PATH=โˆผ/.composer/vendor/bin":$PATH" 
+3
source

For those using Homestead , I found this worked for me

 export PATH="$PATH:$HOME/.config/composer/vendor" 
+3
source

insert this

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

and restart termminal.

+1
source

Just adding to the accepted answer ...

If you execute commands directly on the terminal (in this case, the path will remain accessible until the terminal window or tab is closed)

If you ruined the previous path, you need to open and close the terminal window (or tab)

Example:

execute first (ruin the path somehow)

 PATH="test" 

then do

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

You still get an error Now close the terminal window or tab and close it and execute

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

And the mistake should disappear!

+1
source

Open a terminal and run the following lines:

For zsh and bash:

 export PATH="$HOME/.config/composer/vendor/bin:$PATH" source ~/.zshrc source ~/.bashrc 

For bash only:

 export PATH=~/.config/composer/vendor/bin:$PATH source ~/.bashrc 
+1
source

Check if the /root/.composer EXISTS directory exists, if NOT exists then install the composer as follows:

 curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 

And install laravel again, after which your team will work.

0
source

Source: https://habr.com/ru/post/1242325/


All Articles