Installing Laravel via the Laravel installer - laravel

I have composer installed, but checking the Laravel docs, I'm struggling with:
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
I'm not sure what to do here, could someone explain it to me?

Go to terminal and paste the next line:
nano ~/.bash_profile
After that paste the next line in nano:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Done. Restart your terminal and enjoy laravel.

The PATH environment variable tells your system where to look when you run a command. By default ~/.composer/vendor/bin will not be in your PATH. Therefore, if you just attempt to run the command laravel after installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.
When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin (in *nix, ~ represents your home directory). Adding ~/.composer/vendor/bin to your PATH allows you to just execute the command laravel instead of having to use the full path of ~/.composer/vendor/bin/laravel.
Helpful Stuff:
How to set/change your PATH environment variable in OSX
Installing composer packages globally

Related

Why doesn't composer install Laravel globally in /usr/bin?

The Laravel installation guide says:
First, download the Laravel installer using Composer:
composer global require "laravel/installer"
Make sure to place the $HOME/.composer/vendor/bin directory (or the
equivalent directory for your OS) in your $PATH so the laravel
executable can be located by your system.
Why can't laravel just be installed to /usr/bin like a normal executable?
Is making a symlink instead of adding the path a good idea?
ln -s $HOME/.config/composer/vendor/bin /usr/bin/laravel
Why doesn't composer do this by default?
on MacOS 10.12 I have solve the issue.
after execute the command on terminal
composer global require "laravel/installer"
composer will install laravel/installer on your computer.
Find the location where is installed Laravel installer. Then add a line on ~/.bash_profile
export PATH=<laravel installer location>:$PATH
On my cace <laravel installer location> was /Users/shahriar/.composer/vendor/laravel/installer/bin/
So I have added the line on .bash_profile
export PATH=/Users/shahriar/.composer/vendor/laravel/installer/bin:$PATH
then type a command on terminal source ~/.bash_profile it will update your .bash_profile
and its worked. and now my Laravel installer installed globally.

laravel: command not found in Linux Mint 18

I am a newbie in Laravel and want to set up my first Laravel project. I am following the Laravel documentation. So far, I installed Composer and downloaded the Laravel installer using Composer.Now, the documentation says:
Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.
To set up $PATH variable I have added this line of code in ~/.bashrc file:
export PATH="$PATH:$HOME/.composer/vendor/bin"
But, when I type laravel the terminal says:
laravel: command not found
I searched similar question but couldn't find the right $PATH variable for my OS which is Linux Mint 18.Can you tell me the right $PATH variable or equivalent directory for my OS?Thank You.
After doing more searching, Finally I got the answer to my own question. I find it here:
composer path for Linux Mint 18 This line of code should be added at the bottom of ~/.bashrc fie:
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Make sur composer is configured
composer global require "laravel/installer"
Then, you have to install Laravel first, with this command
composer global require "laravel/installer"
A simple Google search will do. Check the link below:
https://forums.linuxmint.com/viewtopic.php?t=180380
After install laravel using ' composer global require "laravel/installer" '
use the code code below. Its worked for me.
export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Can't find /root/.composer/vendor/bin/laravel: No such file or directory

I have installed composer on Centos 7 virtualbox with PHP 5.6.27. I will show the commands that I have used and the issues that I am now having. I should first say that all of these commands have worked on previous installations.
Okay so for starters here is what I used to install composer.
curl -sS https://getcomposer.org/installer | php
Followed by
mv composer.phar /usr/local/bin/composer
Now I am trying to install laravel via the commands listed below.
composer global require "acacha/adminlte-laravel-installer=~3.0"
Up to this point all of the commands listed above have successfully worked.
Now here is the current problem. When I try to run the following command I get an error.
laravel new laravel-with-admin-lte
-bash: /root/.composer/vendor/bin/laravel: No such file or directory.
I have tried a whole set of remedies for this message but it cannot find the .composer directory. Can anyone tell me where the correct .composer directory is and how I can modify it so that it looks to the proper location to finalize this installation?
I appreciate any solutions that you can provide me. I have struggled with this for two days straight and have googled everything under the sun. Hopefully, someone on here has had a similar solution with a valid resolution.
Put an alias to the freshly installed Laravel installer in your user configuration .bashrc:
nano ~/.bashrc
And place this inside the file:
alias laravel='~/.config/composer/vendor/bin/laravel'
And run the following to make sure your bashrc profile is reloaded:
source ~/.bashrc
laravel new project
download as superuser
download installer
sudo composer global require "laravel/installer=~1.1"
setting up path
export PATH="~/.composer/vendor/bin:$PATH"
check laravel command
laravel
I had the same problem, so I changed the directory.
This is the directory where your bash was created: /root/.config/composer
enter image description here
but when excute the laravel command, the system search en the directory : bash: /root/.composer/vendor/bin/laravel:
enter image description here
So, just you need to change the address /root/.config/composer/vendor to /root/.composer/vendor.
PD. sorry I am learning english, so it is a little bad.

Export composer to path on Ubuntu 16.04

I want to run the laravel command on my machine. But I always get laravel: command not found. I do have globally required Laravel on composer. Most people say that you need to add composer to your path via this command: export PATH=~/.composer/vendor/bin:$PATH. But I don't have the directory ~/.composer'.
The problem is that I can't find the location of composer. Does somebody know the correct location which I need to export to my PATH. Thanks!
Your Composer path is likely ~/.config/composer/vendor/bin. Try adding that instead.
See also Why is COMPOSER_HOME empty?

Confusing step in the Laravel Homestead installation process?

I'm going through the Laravel Homestead setup, but a particular instruction seems to be completely out of context/unexplained. I'm not at all familiar with composer, having only used npm for package management in the past.
In the 'Installing Homestead' section, under With Composer + PHP Tool it reads:
Once the box has been added to your Vagrant installation, you are ready to install the Homestead CLI tool using the Composer global command:
composer global require "laravel/homestead=~2.0"
Make sure to place the ~/.composer/vendor/bin directory in your PATH so the homestead executable is found when you run the homestead command in your terminal.
http://laravel.com/docs/4.2/homestead
Emphasis mine. What does this mean? What ~/.composer/vendor/bin directory? What PATH? Feels like it's missing a step!
Updating the PATH variable is slightly out of the spec of the Laravel docs as its something you should do for composer, but regardless I too think Laravel should at least link through to a resource of how to go about it.
Create/edit your ~/.bash_profile, add the following
export PATH=~/.composer/vendor/bin:$PATH
finally run source ~/.bash_profile to update your environment
I wrote a blog on this which goes into a little more detail http://blog.iwader.co.uk/updating-path-environment-variable-osx-and-unix-systems/

Resources