欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Call to undefined method Illuminate\Foundation\Application::bindShared() after updating to Laravel 5.2#55 见红色字部分 有大用

Hello all,

The entire error is below. I tried googling a bit and tried removing composer.lock. Also tried getting dev-master to see if there was something there. Not sure what else I can try. Please let me know if I can help debug by trying something else.

Thanks!
-Tim

PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::bindShared() in /home/vagrant/myapp/vendor/laracasts/flash/src/Laracasts/Flash/FlashServiceProvider.php on line 27
PHP Stack trace:
PHP 1. {main}() /home/vagrant/myapp/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/vagrant/myapp/artisan:36
PHP 3. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:105
PHP 4. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 5. Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 6. Illuminate\Foundation\Application->registerConfiguredProviders() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php:17
PHP 7. Illuminate\Foundation\ProviderRepository->load() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:507
PHP 8. Illuminate\Foundation\Application->register() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:74
PHP 9. Laracasts\Flash\FlashServiceProvider->register() /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:531

[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::bindShared()

 
@fare4z

i have same issue

 
@kameshveera

i have same issue.kindly help me.

 
@raviror

Hello,
bindShared() have been replaced with singleton()
It is located here: /path-to-your-project/vendor/illuminate/html/HtmlServiceProvider.php
change on line no : 36 and 49

 
@Poltynik

You should remove this outdated package - "illuminate/html": "^5.0"
More here -
http://stackoverflow.com/questions/35151478/laravel-upgrading-to-5-2-0-from-5-1-error/35151551#answer-35159166

 
@gdmfx

+1

 
@talam0nal

You need to remove this outdated package (taken out of the core and no longer supported):

"illuminate/html": "^5.0",
When you remove it, you need to also remove its service providers / aliases. So, if you open up config/app.php, you will see a providers and aliases section. Remove these lines of code if you haven't done so already.

'Illuminate\Html\HtmlServiceProvider'

'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade',

In place of it, you should install the Laravel collective package. To install that, replace the illuminate/html package with this:

"laravelcollective/html": "5.2.*"
Then in your config/app.php file, add this to your providers array:

Collective\Html\HtmlServiceProvider::class
and this to your aliases array:

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

The docs can be found here:https://laravelcollective.com/docs/5.2/html

 
@mayarodina

Despite having installed as that, I am getting an HTML class not found when

{{ !!! HTML ::style('css/styles') !!}}

I am using c9 as development environment. I am flummoxed, because I have just installed the new version and updated as per these directions given.

UPDATE SOLUTION:
They have changed it to Html

 
@geekhack

@talam0nal, your answer worked for me.Thanks,just learning the framework,its learning curve is much easier compared to some I have tried out in the past.

 
@anildsvv14

Dear all i have used the singleton() by replacing the bindShared() in whole HtmlServiceProvider.php and its working for me so just try that and the error definitely goes.....

 
@ranjithkadumeni

Thanks. its works..

 
 
@Gynidark

Thanks! an update on the repo would be welcome:+1:

 
@OmarySudi

thanks reviror It works by changing bindShare() to singleton()

 
@frayhan94

This work when removing outdated package :)

 

普通分类: