Laravel Artisan 命令出错

Error in Laravel Artisan command

我是 Laravel 的新人。我正在使用 Laravel 5.3.I 使用下面的代码来安装 Laravel 5.3.

php composer.phar create-project laravel/laravel=5.3 addbook dev-develop

我尝试执行 "php artsisan --v" 但我发现以下错误

PHP Fatal error:  Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93

Stack trace:

#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\php7\htdocs\...', 93, Array)

#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)

#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(ErrorException))

#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(ErrorException))

#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(ErrorExce
ption))

#5 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Exce in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundatio
n\Exceptions\Handler.php on line 93
PHP Fatal error:  Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93

Stack trace:

#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\php7\htdocs\...', 93, Array)
#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)
#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorEx
ception))
#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(Symfony\C
omponent\Debug in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate
\Foundation\Exceptions\Handler.php on line 93

谁能说说解决方法是什么??

你需要拉稳定版本,尝试添加参数 --prefer-dist

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

好吧,不要使用 develop 分支!

运行 php composer.phar create-project --prefer-dist laravel/laravel=5.3 addbook.


此外,如果您的 Composer Vendor 文件夹是您的路径,您应该可以通过 运行 实现相同的目的 laravel new addbook