laravel从5.1更新到5.2 Composer更新错误 [英] laravel update from 5.1 to 5.2 composer update error
问题描述
我正在尝试将laravel从5.1更新到5.2.我按照更新文档的说明进行操作,但出现此错误在运行作曲家udpate时:
I am trying to update laravel from 5.1 to 5.2 . I followed the instruction as according to update doc but I am getting this error when running composer udpate:
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::bindShared() in /my_app/vendor/illuminate/html/HtmlSe
rviceProvider.php on line 36
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::bindShared() in /my_app/vendor/illuminate/html/HtmlSe
rviceProvider.php on line 36
我查看了这个问题,看到人们在更新到5.1版时遇到了这个问题,并看到bindShared方法已被singleton()取代,但是我不想弄乱供应商文件. 这是我的config/app.php提供程序和别名数组:
I've looked up this issue and saw that people were getting this issue when updating to version 5.1 and saw that the method bindShared has been replaced with singleton(), but I don't want to mess with vendor files. Here is my config/app.php providers and aliases arrays:
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Illuminate\Html\HtmlServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewComposerServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
Baum\Providers\BaumServiceProvider::class
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Input' => Illuminate\Support\Facades\Input::class,
'Inspiring' => Illuminate\Foundation\Inspiring::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Illuminate\Html\FormFacade::class,
'Html' => Illuminate\Html\HtmlFacade::class,
'Carbon' => 'Carbon\Carbon',
'Flash' => Laracasts\Flash\Flash::class,
],
这是我的composer.json:
and here is my composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"repositories": [{
"type": "vcs",
"url": "https://github.com/nWidart/Elasticquent"
}],
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.6@dev",
"illuminate/html": "^5.0@dev",
"laracasts/flash": "dev-master",
"fairholm/elasticquent": "dev-feature/laravel-5",
"baum/baum": "~1.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true
}
您知道我应该怎么做才能解决此问题吗?我从laravel的5.1版本安装开始.
any idea what I should do to fix this? I started with a 5.1 version install of laravel.
推荐答案
Laravel不再支持"illuminate/html"
组件,并且该组件与5.2版本不兼容.
The "illuminate/html"
component is no more supported by Laravel and is not compatible with the 5.2 version.
您可以将其替换为 laravelcollective/html
您必须:
-
从
composer.json
添加"laravelcollective/html": "5.1.*"
(或所需的版本)
运行composer update
来更新依赖关系(这将删除您的"illuminate/html"
组件并安装"laravelcollective/html"
组件
run composer update
to update the dependecies (this will remove your "illuminate/html"
component and install the "laravelcollective/html"
component
现在,您必须将HTML服务提供商替换为:
Now you have to replace your HTML service provider with:
'providers' => [
Collective\Html\HtmlServiceProvider::class,
],
和外墙:
'aliases' => [
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
],
这篇关于laravel从5.1更新到5.2 Composer更新错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!