Laravel 5.1:安装新的错误

Posted

技术标签:

【中文标题】Laravel 5.1:安装新的错误【英文标题】:Laravel 5.1 : Error on install new 【发布时间】:2015-09-05 20:56:41 【问题描述】:

当我运行 laravel new blog 或任何名称时,我收到以下错误:

Crafting application...
php Fatal error:  Uncaught TypeException: Argument 2 passed to GuzzleHttp\Adapter\StreamAdapter::createResponseObject() must be of the type array, null given, called in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 67 and defined in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php:71
Stack trace:
#0 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(67): GuzzleHttp\Adapter\StreamAdapter->createResponseObject(Object(GuzzleHttp\Message\Request), NULL, Object(GuzzleHttp\Adapter\Transaction), Object(GuzzleHttp\Stream\Stream))
#1 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(52): GuzzleHttp\Adapter\StreamAdapter->createResponse(Object(GuzzleHttp\Adapter\Transaction))
#2 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Client.php(193): GuzzleHttp\Adapter\StreamAdapter->send(Object(GuzzleHttp\Adapter\Transaction)) #3 C:\U in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 71

Fatal error: Uncaught TypeException: Argument 2 passed to GuzzleHttp\Adapter\StreamAdapter::createResponseObject() must be of the type array, null given, called in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 67 and defined in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php:71
Stack trace:
#0 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(67): GuzzleHttp\Adapter\StreamAdapter->createResponseObject(Object(GuzzleHttp\Message\Request), NULL, Object(GuzzleHttp\Adapter\Transaction), Object(GuzzleHttp\Stream\Stream))
#1 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(52): GuzzleHttp\Adapter\StreamAdapter->createResponse(Object(GuzzleHttp\Adapter\Transaction))
#2 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Client.php(193): GuzzleHttp\Adapter\StreamAdapter->send(Object(GuzzleHttp\Adapter\Transaction)) #3 C:\U in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 71

我不明白这怎么会发生。 Here is my PhpInfo file

谢谢

【问题讨论】:

【参考方案1】:

答案很简单。我从 PHP7 而不是 XAMPP/PHP5 运行 PHP CLI。只需取消注释extension=php_curl.dll 行。

【讨论】:

composer global update 将是一个很好的起点。就我而言,我没有安装 php 7 的 curl 扩展,也没有安装 zip。由于我在 Ubuntu 上,sudo apt-get install php7.0-curl php7.0-zip 成功了。 @ruuter 你刚刚救了我的命!

以上是关于Laravel 5.1:安装新的错误的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 14.04 上的 Laravel 5.1 本地主机错误

Laravel 5.1 创建或更新重复

使用MAMP在OSX上安装Laravel 5.1

Laravel 5.1 MethodNotAllowedHttpException 错误

新的 Laravel 安装给 Mcrypt “错误”。 (OSX)

Laravel 5.1 - 模型工厂错误种子