作曲家创建项目未安装 Laravel 5.3
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39232253/
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 create-project not installing Laravel 5.3
提问by Picrasma
I have been trying to no avail to install Laravel 5.3 but keep getting 5.2 installed. Here's what i have done.
我一直在尝试安装 Laravel 5.3 无济于事,但一直在安装 5.2。这是我所做的。
composer create-project laravel/laravel laravel53
This should pull in the latest version of laravel which is 5.3 right? Well, i thought so but i keep getting 5.2 installed
这应该拉入最新版本的 Laravel 5.3 对吗?好吧,我是这么认为的,但我一直在安装 5.2
Then i felt it may be a problem with composer so i ran composer self-update
然后我觉得这可能是作曲家的问题,所以我跑了作曲家自我更新
composer self-update
And still get 5.2 installed when i run create-project
当我运行 create-project 时仍然安装了 5.2
I'm pretty sure i am getting something wrong because i ran this same command on a friend's laptop and 5.3 got installed
我很确定我出了什么问题,因为我在朋友的笔记本电脑上运行了相同的命令并且安装了 5.3
I am using a mac book pro BTW
我正在使用 mac book pro BTW
Any ideas why this is so and how it can be solved?
任何想法为什么会这样以及如何解决?
Much thanks
非常感谢
回答by Picrasma
I found out that the problem has been my php version all along. The version I had was 5.5 and laravel 5.3 requires php version 5.6 or higher.
我发现问题一直是我的 php 版本。我的版本是 5.5,laravel 5.3 需要 php 5.6 或更高版本。
For anyone having this issue, first thing you might want to do is to check your php version and upgrade to 5.6 or higher. This one line installation worked for me
对于遇到此问题的任何人,您可能想要做的第一件事是检查您的 php 版本并升级到 5.6 或更高版本。这一条线安装对我有用
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
Depending on the version you want and the OS specs, check this resource out http://php-osx.liip.ch/it was very helpful for me.
根据您想要的版本和操作系统规格,请查看此资源http://php-osx.liip.ch/它对我非常有帮助。
so to install laravel5.3, you could use composer create-project:
所以要安装laravel5.3,你可以使用composer create-project:
composer create-project laravel/laravel projectName
or
或者
composer create-project laravel/laravel=5.3.0 projectName --prefer-dist
Thanks and good luck!
谢谢,祝你好运!
回答by Moppo
First of all try to clear the composer cache:
首先尝试清除作曲家缓存:
composer clear-cache
Then try with this command:
然后尝试使用此命令:
composer create-project laravel/laravel=5.3.4 laravel53 --prefer-dist
Alternatively, open the composer.json
file and change this:
或者,打开composer.json
文件并更改:
"require": {
"laravel/framework": "5.2.*"
},
to:
到:
"require": {
"laravel/framework": "5.3.*"
},
and then composer update
进而 composer update
回答by Fathurrahman Abahh
I just tried with php 5.6.3 and failed,
我刚刚尝试使用 php 5.6.3 并失败了,
make sure your php version is >= 5.6.4
确保您的 php 版本 >= 5.6.4
回答by Anita Mourya
I already had PHP 5.6 but it was not able to write .env file so I was required to run the command using sudo.
我已经有了 PHP 5.6 但它无法编写 .env 文件,所以我需要使用 sudo 运行命令。