php 作曲家 laravel 创建项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18862160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
composer laravel create project
提问by Aken Roberts
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
我正在尝试使用 Laravel,当我开始一个项目并输入composer create-project /Applications/MAMP/htdocs/test_laravel
终端时,它会显示
[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
?
如何解决?
这一步是否等于创建文件夹和文件,就像我从 laravel git 下载的那样laravel-master.zip
?
--
MAMP php5.4.10
--
MAMP php5.4.10
回答by Aken Roberts
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.
您错误地将本地路径指定为您希望从中创建项目的 Composer/Packagist 包。因此,“找不到包”消息。
Simply make sure you're specifying the Laravel package and you should be good to go:
只需确保您指定了 Laravel 包,就可以了:
composer create-project laravel/laravel /Applications/MAMP/htdocs/test_laravel
回答by manish
I also had same problem then I found thison 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
因此,如果您想按test_laravel
目录中的名称创建项目,/Applications/MAMP/htdocs/
那么您需要做的是
go to your project parent directory
转到您的项目父目录
cd /Applications/MAMP/htdocs
cd /应用程序/MAMP/htdocs
and fire this command
并触发此命令
composer create-project laravel/laravel test_laravel --prefer-dist
作曲家创建项目 laravel/laravel test_laravel --prefer-dist
that's it, this is really easy and it also creates Application Key automatically for you
就是这样,这真的很简单,它还会为您自动创建应用程序密钥
回答by ROSHNI
composer create-project laravel/laravel ProjectName
回答by Senthil
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.
我的几毛钱。包名 (laravel* /*laravel) 中的正斜杠很重要。如果你放反斜杠,你会得到 package not found 稳定性错误。
回答by user11652339
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.
您首先需要使用命令安装laravel:composer global require laravel/installer
然后使用composer create-project
命令您的问题将得到解决。我希望你的问题现在已经解决了。
回答by Fatimah Mohmmed
make sure that your composer is up to date. write in the cmd
确保您的作曲家是最新的。在cmd里写
composer create-project –-prefer-dist laravel/laravel NameOfProject "Version"
回答by Quang Sáng
- Create project
- Open: Root (htdocs)\
- Press: Shift + Open command windows here
- Type:
php composer.phar create-project --prefer-dist laravel/laravel lar-project "5.7.*"
- 创建项目
- 打开:根(htdocs)\
- 按:Shift + 在此处打开命令窗口
- 类型:
php composer.phar create-project --prefer-dist laravel/laravel lar-project "5.7.*"
回答by Naughty.Coder
Dont write with stability stable
in the command ,
in your composer.json file, put "minimum-stability": "stable"
before the closing curly bracket.
不要写with stability stable
在命令中,
在你的 composer.json 文件中,放在"minimum-stability": "stable"
右大括号之前。
回答by Iram
No this step isn't equal to downloading the laravel.zip by using the command composer create-project laravel/laravel laravelyou actually download the laravel project as well as dependent packages so its one step ahead.
不,这一步并不等于通过使用命令 composer create-project laravel/laravel laravel下载laravel.zip您实际上下载了 laravel 项目以及依赖包,因此它领先一步。
If you are using windows environment you can solve the problem by deleting the composer environment variableyou created to install the composer. And this command will run properly.
如果您使用的是 windows 环境,您可以通过删除您为安装 composer 而创建的 composer 环境变量来解决问题。并且此命令将正常运行。