繁体   English   中英

无法在 Laravel 5.1 中安装 Laravelcollective/HTML

[英]Can't install Laravelcollective/HTML in Laravel 5.1

我在 Laravel 5.1 Install laravelcollective/html document 中安装 Laravelcollective/HTML 时遇到问题。 首先,我通过 Composer 安装:

composer require illuminate/html

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

但它是 5.0 版所以删除它。

composer remove illuminate/html

并安装 5.1 版

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

接下来,从终端更新 Composer:

composer update

接下来,将您的新提供程序添加到 config/app.php 的 providers 数组中:

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

最后,在 config/app.php 的 aliases 数组中添加两个类别名:

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

和消息错误:

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

在我运行 composer update 之前,我以某种方式将下面的内容添加到 config/app.php 中,因此它产生了与您遇到的相同的错误。

在进行 Composer 更新之前不要添加以下内容。

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

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

我得到了解决方案。 您可以通过 Composer 在下面运行此命令。 它将安装laravelcollective/html

composer require laravelcollective/html

我的问题是我有一个缓存的配置文件,我无法重新缓存它,因为它是通过 artisan 缓存的,而 artisan 抛出了错误。

解决方案:

删除:

bootstrap/cache/config.php

composer update

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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