无法在 Windows 上通过 Laravel 安装程序安装 Laravel 4.2?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28382310/
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
Installing Laravel 4.2 via Laravel installer not possible on windows?
提问by Pratik
While installing laravel on windows via laravel installer with command composer global require "laravel/installer=~1.1"
then laravel new project-name
, it now instal laravel 5.0, latest version. How to install laravel 4.2 version via laravel installer with laravel new
command??
在 Windows 上通过 laravel 安装程序使用命令composer global require "laravel/installer=~1.1"
thenlaravel new project-name
安装 laravel 时,它现在安装 laravel 5.0,最新版本。如何使用laravel new
命令通过 laravel 安装程序安装 laravel 4.2 版本?
回答by lukasgeiter
No that's not possible with the laravel installer. It will always get the latest release. Here's the source of the laravel new
command
不,laravel 安装程序不可能做到这一点。它将始终获得最新版本。这是命令的来源laravel new
protected function download($zipFile)
{
$response = \GuzzleHttp\get('http://cabinet.laravel.com/latest.zip')->getBody();
// ^^^^^^^^^^
file_put_contents($zipFile, $response);
return $this;
}
What you can do is use composer create-project
and specify the version:
您可以做的是使用composer create-project
并指定版本:
composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist
By the way ~4.2.0
means that you will get the latest version with 4.2.*
(currently that's 4.2.11)
顺便~4.2.0
说一下,您将获得最新版本4.2.*
(目前是 4.2.11)
回答by Eduardo Chongkan
This works for me on top of homestead:
这在宅基地上对我有用:
$ composer create-project laravel/laravel YOURFOLDERNAME 4.2.*
Note the * for the version #.
注意版本号的 *。
Outputs:
输出:
Installing laravel/laravel (v4.2.11)
- Installing laravel/laravel (v4.2.11)
Downloading: 100%
回答by KazikM
If you don't plan to create multiple 4.2 projects, you can install single one by issuing another Composer command:
如果您不打算创建多个 4.2 项目,您可以通过发出另一个 Composer 命令来安装单个项目:
composer create-project laravel/laravel foldername "4.2" --prefer-dist
composer create-project laravel/laravel foldername "4.2" --prefer-dist
where foldername is a name of folder for your project and "4.2" specifies version to install.
其中 foldername 是项目文件夹的名称,“4.2”指定要安装的版本。
I tried it on my Windows 7 machine just now, it works.
我刚才在我的 Windows 7 机器上试过了,它有效。
P.S. Laravel documentation shows slightly different syntax:composer create-project laravel/laravel "4.2" --prefer-dist
but this creates 5.0 installation in folder named "4.2".
PS Laravel 文档显示的语法略有不同:composer create-project laravel/laravel "4.2" --prefer-dist
但这会在名为“4.2”的文件夹中创建 5.0 安装。
回答by Bamboe
- Delete XAMMP and/or Homestead
- Install Laragon (http://laragon.org/)
- 删除 XAMMP 和/或 Homestead
- 安装 Laragon ( http://laragon.org/)
This should solve the problem. Happy Programming
这应该可以解决问题。快乐编程
回答by TurKux
This should do the work.
这应该可以完成工作。
composer create-project laravel/laravel {{projectName}} 4.2.* --prefer-dist
回答by Jayjay
回答by Jayjay
It's better to use composer
最好使用composer
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
Just open your power shell and cd to the directory you want to run the project, and run the above command, make sure you have composerfirst.
只需打开你的power shell,cd到你要运行项目的目录,然后运行上面的命令,确保你先有composer。