找不到类“Illuminate\Html\HtmlServiceProvider”

Posted

技术标签:

【中文标题】找不到类“Illuminate\\Html\\HtmlServiceProvider”【英文标题】:Class 'Illuminate\Html\HtmlServiceProvider' not found找不到类“Illuminate\Html\HtmlServiceProvider” 【发布时间】:2015-11-19 12:08:03 【问题描述】:

当我尝试作曲家更新时

  root@tito:/var/www/laravel# composer update
> php artisan clear-compiled
PHP Fatal error:  Class 'Collective\html\HtmlServiceProvider' not found in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146

我正在使用 laravel 5,我收到了这条消息:

'Illuminate\Html\HtmlServiceProvider'
 not found in `/var/www/laravel/vendor/laravel/framework/src/Illuminate/Founda`

这里是 app.php 中的提供者和别名

    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Routing\ControllerServiceProvider::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,

    ],    

    '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,


    ],

];

为什么会出现这个错误?

我不能做 php artisan Illuminate\Html 我不能做 composer require Illuminate\Html

【问题讨论】:

你是否为 Html 添加了外观? 是的,像这样? 'Form' => Illuminate\Html\FormFacade::class, 'Html' => Illuminate\Html\HtmlFacade::class, 等一下,你使用的是 Laravel 5 还是 5.1? 【参考方案1】:

我刚用过

composer update --no-scripts

现在一切正常 =)

【讨论】:

请使用您问题上的编辑链接添加更多信息。 Post Answer 按钮应仅用于问题的完整答案。 @NicolaiReuschling 我相信他的意思是说他使用此答案中发布的代码解决了自己的问题。 是的,我解决了,我只能接受明天的回答oO @MarsAtomic 我仍然相信答案可以改进。例如。运行给定命令时会发生什么。 所以提供程序已配置但未安装?还是 composer 的 dump-autoload 找到了?

以上是关于找不到类“Illuminate\Html\HtmlServiceProvider”的主要内容,如果未能解决你的问题,请参考以下文章

找不到 Spring Boot Mongo Reactive 类 - 找不到类 [org.springframework.data.mongodb.MongoDatabaseFactory]

找不到xml找不到类

java 主启动类找不到

找不到类 'dalvik.system....'

eclipse 保存后就找不到类

找不到类“Fideloper\Proxy\TrustProxies”