Junior
Junior

Reputation: 12002

How to correctly create a laravel project?

I am trying to use laravel 5.1 on Windows Server 2008 R2.

I following the documentation when I try to create a new project like this

laravel new blog

I get the following

Crafting application...
Could not open input file: composer.phar
Application ready! Build something amazing.

where is it looking for composer.phar so I can move it to the correct place?

Additionally when I issue the same command again

laravel new blog

I get this other issue

  [RuntimeException]
  Application already exists!



new <name>

What do I need to do to correctly create a new project?

Thank you

Upvotes: 1

Views: 4684

Answers (2)

dakine
dakine

Reputation: 699

first, delete the blog folder that was generated. then do

composer create-project laravel/laravel blog --prefer-dist

or

composer.phar create-project laravel/laravel blog --prefer-dist

it's just an alternative of laravel new blog. I have the same error as yours so i just use the other command with same result.

Upvotes: 3

TylerN
TylerN

Reputation: 70

Oh the Laravel documentation... What fond memories...

First, you should try listing the directory and this might open up to what's going on a little better. What you will find is that 'laravel new blog' creates a directory called 'blog' and tries to copy all of the laravel 'boilerplate' so that you are ready to start working. However, Laravel uses Composer in order to handle dependencies, which is why you are seeing this error.

One solution is to add composer.phar to your path. How to do this will depend on your system, but it should be reasonably well-documented. I'm not familiar with Windows Server 2008, so I can't help there.

Another option is to have composer.phar in the directory that you are running 'laravel new blog' on. I can't test this right now, but i'm pretty confident that is where it looks if it doesn't find it in the path. So for example:

directory structure:
www
-->composer.phar

After running 'laravel new blog'

www
-->composter.phar
-->blog

It sounds like you'll need to remove the blog directory before running 'laravel new ...' again because you've already ran it once.

Upvotes: 0

Related Questions