31
votes

I'm trying to start laravel,

Found the following line in their tutorial:

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 don't understand what I should do ?

I added ~/.composer/vendor/bin to my system variables, and then tried using 'laravel new blog' in the command line but got the following message :

laravel is not recognized as an internal or external command

what should I do?

6
Did you first run "composer global require "laravel/installer=~1.1" "?Thelonias
What OS are you running and trying to do this?Jared Eitnier
Yes I ran composer global require "laravel/installer=~1.1 at first and I'm using windows 8.1 operating systemdarroosh
@darroosh I hope your problem got resolved when you used the absolute path instead of the relative one. Please accept Mantas D's answer and close this question.ikartik90

6 Answers

41
votes

For Windows add

C:\Users\MyUserName\AppData\Roaming\Composer\vendor\bin 

... to directory by going to "My Computer" > "Properties" > "Advanced" > "Environment > Variables" > "Path".

Note: MyUserName is your pc username .

Restart your PC and it would work

48
votes

Use correct path to the Composer bin directory.

Good:

%USERPROFILE%\AppData\Roaming\Composer\vendor\bin

Bad:

~/.composer/vendor/bin
15
votes

For me after adding PATH to environment variables result was the same. I found me answer here

So at first you have to run in cmd

composer global require "laravel/installer=~1.1"

and then the message appears

" Changing directory to C:\Users\USER\AppData\Roaming\Composer\vendor\bin "

and after that you can run your command. For example

laravel new blog
5
votes

You need to install Laravel using

composer global require laravel/installer

Otherwise, even adding it to PATH won't help.

3
votes

First, use:

composer global require "laravel/installer=~1.1"

Then, you can try again.

laravel new project
-1
votes

this command has solved my problem.

composer global require "laravel/installer=~1.1"