69

我无法启动并运行 Laravel 5.0 的测试实例,因此我可以协助完成此过渡。

1)从https://github.com/laravel/laravel/tree/develop创建一个新的应用程序在运行时会导致以下错误composer install

{"error":
    {"type":"ErrorException",
     "message":"Undefined index: timezone",
     "file":"\/Projects\/indatus\/dispatcher-test-app\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/start.php",
     "line":167}
}
{"error":
    {"type":"ErrorException",
     "message":"Undefined index: timezone",
     "file":"\/Projects\/indatus\/dispatcher-test-app\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/start.php",
     "line":167}}

我完全错过了什么吗?

更新:这个问题/答案仅在 Laravel 5 处于开发阶段时才相关。你现在应该参考Laravel 文档来了解如何安装 Laravel

4

5 回答 5

124

As Laravel 5 is already final release, to install it, you should run

composer create-project laravel/laravel test-laravel-5-project --prefer-dist 

in your console. test-laravel-5-project is the name of your project you can call it anyway you want - for example myblog, myapp etc. Laravel files will be put inside this directory

You can also use alternative method using

composer global require "laravel/installer=~1.1"

and then running

laravel new test-laravel-5-project 

For detailed info you should look at official Laravel installation notes


The below answer is being kept only for historical reasons and it was valid when Laravel 5 still was in its development stages. You should now only use the method mentioned above

I've just tested this and there are two ways of installing Laravel 5:

One-step method

You just run:

composer create-project laravel/laravel test-laravel-5-project dev-develop --prefer-dist

and composer will create the whole directory structure. In above command test-laravel-5-project is your project name - you can of course name it as you want (composer will create directory with this name and put all Laravel5 files inside this directory)

Multi-step method

  1. Download https://github.com/laravel/laravel/tree/develop with option Download ZIP
  2. Unpack it in web directory
  3. Run composer update (not composer install) in directory where you unpacked your ZIP file

Using both methods when you run URL for your project in the browser (for example http://localhost/projects/test-laravel-5-project/public depending on your webserver settings ) you will get standard Laravel website You have arrived.

Both methods should work well. Give either one a try, whichever works best for you.

于 2014-09-20T13:26:57.147 回答
8

Go to CLI and enter following command line. make sure composer is already installed.

$composer create-project laravel/laravel <yourdirectryname> dev-develop It will ask you a question about removing .git files enter Y then. change the directory to

$cd <yourdirectoryname> then enter following command

$ php artisan -V

you will be able to see following message.

Laravel Framework version 5.0-dev means you have installed laravel 5 successfully!

于 2014-09-23T14:38:23.240 回答
1

从您要存储项目的位置运行此命令

composer create-project laravel/laravel <projectname>

请记住,它将从 git 下载最新版本的 laravel 应用程序。

如果您使用的是 linux,则通过从 laravel 项目的根目录运行命令来授予引导/缓存存储权限chmod 777 -R <dir name>

于 2016-02-24T06:35:21.663 回答
0

作曲家全局需要“laravel/installer=~1.1”

于 2016-09-21T10:07:58.743 回答
0

首先你需要通过这个命令在你的系统中全局安装 laravel

composer global 需要 laravel/installer 那么你可以通过三种方式安装 laravel,1)去 laravel github Reqosritory 下载它的 zip,然后它获取 ssh 或 Https url 并从 CMD 或 Git bash 安装它 2)打开 Git bash 只需编写laravel new那里,这将下载最新的 laravel 版本 3)打开 cmd 或 git bash 并在那里写。 composer create-project --prefer-dist laravel/laravel blog 如果你想安装一些旧版本,那么你可以在最后写下提到的版本。 composer create-project --prefer-dist laravel/laravel 博客 5.2.*

于 2019-08-22T10:37:56.130 回答