【问题标题】:Switching from Illuminate\Html to Collective\Html, Class 'Illuminate\Html\HtmlServiceProvider' not found从 Illuminate\Html 切换到 Collective\Html,找不到类 'Illuminate\Html\HtmlServiceProvider'
【发布时间】:2015-11-23 20:47:00
【问题描述】:

我更新了composer.json 删除了Illumination\html 并添加了:

"require": {
    "laravelcollective/html": "5.1.*"

我从 app.php 中删除了 Illuminate\Html 的提供程序/别名并添加了替换项:

    Collective\Html\HtmlServiceProvider::class,

...

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

但是在运行composer update 时,我收到了输出:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing illuminate/html (v5.0.0)

- Installing laravelcollective/html (v5.1.4)
  Downloading: 100%  

Writing lock file
Generating autoload files
> php artisan clear-compiled
PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648

[Symfony\Component\Debug\Exception\FatalErrorException]  
Class 'Illuminate\Html\HtmlServiceProvider' not found                                                     

Script php artisan clear-compiled handling the post-update-cmd event returned with an error

[RuntimeException]                                                                   
Error Output: PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648 

我尝试按照此处的建议更新 composer.json 脚本:https://github.com/LaravelCollective/html/issues/54

但我仍然收到错误消息。 非常感谢任何帮助:)

【问题讨论】:

    标签: laravel laravel-5 laravel-5.1 laravelcollective


    【解决方案1】:

    最后,我在 IRC(感谢 sisve)和这些命令的帮助下设法解决了这个问题。首先,我使用Illumination/html 回滚到一个工作站点。那么:

    composer dumpautoload
    composer clearcache
    php artisan clear-compiled
    

    如果clear-compiled 失败,请确保bootstrap/cache/config.php 中没有对 Illuminate\Html 的引用,然后再次运行。

    删除config/app.php 中对 Illuminate\Html 的所有引用
    删除 composer.json 中的 illuminate/html 要求

    composer update
    

    按照此处所述添加 laravelcollective/html 包:http://laravelcollective.com/docs/5.1/html#installation

    composer update
    

    【讨论】:

      猜你喜欢
      • 2015-11-19
      • 1970-01-01
      • 2017-07-07
      • 2015-04-16
      • 2018-11-08
      • 2015-12-10
      • 2015-10-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多