简体   繁体   中英

Can't install Laravelcollective/HTML in Laravel 5.1

I have problem when install Laravelcollective/HTML in Laravel 5.1 Install laravelcollective/html document . First, I install through Composer:

composer require illuminate/html

Message: Using version ~5.0 for illuminate/html ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)

But it's version 5.0 so remove it.

composer remove illuminate/html

And install version 5.1

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

Next, update Composer from the Terminal:

composer update

Next, add your new provider to the providers array of config/app.php:

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

Finally, add two class aliases to the aliases array of config/app.php:

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

And message error:

 FatalErrorException in ProviderRepository.php line 146:
 Class 'Collective\Html\HtmlServiceProvider' not found

Before I ran composer update, I had somehow added to config/app.php the below and thus it generated the same error you were getting.

Don't add the below until after doing the composer update.

'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

I got a solution. You can run this command below by composer. It will install laravelcollective/html

composer require laravelcollective/html

My problem was I had a cached config file, I could not re-cache it since it gets cached via artisan and artisan was throwing the error.

Solution:

Removed:

bootstrap/cache/config.php

composer update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM