38

I'm trying to use laravel, when I start a project and type composer create-project /Applications/MAMP/htdocs/test_laravel in terminal it shows

[InvalidArgumentException]                                                   
Could not find package /applications/mamp/htdocs/test_laravel with stabilit  
y stable.    

and

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [package] [directory] [version]

How to fix it ?
and is this step equal to create folder and file like I download from laravel git laravel-master.zip ?

--
MAMP php5.4.10

13 Answers13

73

You are missing a parameter in the command. It should be in this order:

composer create-project [PACKAGE] [DESTINATION PATH] [--FLAGS]

You're mistakingly specifying your local path as the Composer/Packagist package you wish to create a project from. Hence the "Could not find package" message.

Simply make sure you're specifying the Laravel package and you should be good to go:

composer create-project laravel/laravel /Applications/MAMP/htdocs/test_laravel
Aken Roberts
  • 13,012
  • 3
  • 34
  • 40
  • 9
    Why not just `composer create-project laravel/laravel myapp`, do this command in that folder where you want the project to be installed. – Aaron Liu Jun 16 '16 at 17:07
15

I also had same problem then I found this on there documentation page

So if you want to create a project by name of test_laravel in directory /Applications/MAMP/htdocs/ then what you need to do is

go to your project parent directory

cd /Applications/MAMP/htdocs

and fire this command

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

that's it, this is really easy and it also creates Application Key automatically for you

Manish
  • 1,946
  • 2
  • 24
  • 36
14
composer create-project laravel/laravel ProjectName 
ROSHNI
  • 171
  • 2
  • 12
9

There are two simple methods for creating laravel Project

Method 1

composer create-project --prefer-dist laravel/laravel <project-name>

Method 2

laravel new <project-name>

Method 2 might require you to run one extra command

composer global require laravel/installer

if you face 'laravel command not found' error

Afzal Ali
  • 880
  • 8
  • 25
3

My few cents. The forward-slash in the package name (laravel*/*laravel) is matter. If you put back-slash you will get package not found stability error.

Senthil
  • 1,499
  • 16
  • 17
1

make sure that your composer is up to date. write in the cmd

composer create-project –-prefer-dist laravel/laravel NameOfProject "Version" 
kya
  • 1,798
  • 8
  • 35
  • 61
Fatimah Mohmmed
  • 147
  • 2
  • 18
1
  1. Create project
  2. Open: Root (htdocs)\
  3. Press: Shift + Open command windows here
  4. Type: php composer.phar create-project --prefer-dist laravel/laravel lar-project "5.7.*"
Jayesh Babu
  • 1,389
  • 2
  • 20
  • 34
1

Following command will help you to create a new project with a specific version on laravel

composer create-project laravel/laravel:8.* project_name

supported versions are below

laravel/laravel:8.*
laravel/laravel:7.*
laravel/laravel:6.*
laravel/laravel:5.*
Mohamed Raza
  • 818
  • 7
  • 24
0

Dont write with stability stable in the command ,
in your composer.json file, put
"minimum-stability": "stable" before the closing curly bracket.

Naughty.Coder
  • 3,922
  • 7
  • 32
  • 41
  • 1
    Thanks for reply! where can i find composer.json file? –  Sep 18 '13 at 01:24
  • did you mean the correct step: I still have to download larval-master.zip and unzip, copy the file/folder inside to myproject(test_laravel). then type command in terminal `composer create-project /Applications/MAMP/htdocs/test_laravel` –  Sep 18 '13 at 01:30
  • .. so I type the command `composer create-project /Applications/MAMP/htdocs/test_laravel` in terminal but where is composer.json file? –  Sep 18 '13 at 01:41
0

you first need to install laravel using command: composer global require laravel/installer then use composer create-project command your problem will be solved. I hope your problem is now solved.

hexYeah
  • 1,040
  • 2
  • 14
  • 24
0

First, you have to locate the project directory in cmd After this fire below command and 'first_laravel_app' is the project name you can replace it with your own project name.

composer create-project laravel/laravel first_laravel_app --prefer-dist
Ankur prajapati
  • 485
  • 6
  • 9
0

Run Laravel Project in Windows

Install XAMPP ----- Install Composer Command Line Installation

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

   -----

Install Laravel

composer global require "laravel/installer"

   -----

Create Laravel Project

composer create-project --prefer-dist laravel/laravel MyFirstLaravelProject .

-1

No this step isn't equal to downloading the laravel.zip by using the command composer create-project laravel/laravel laravel you actually download the laravel project as well as dependent packages so its one step ahead.

If you are using windows environment you can solve the problem by deleting the composer environment variable you created to install the composer. And this command will run properly.

Iram
  • 278
  • 2
  • 6