I know there are a bunch of other questions floating around out there with the same error, such as: Class 'Illuminate\Html\HtmlServiceProvider' not found Laravel 5

我的问题是,我在本地(XAMPP)上遵循了所有建议的步骤来解决这个问题,并且它毫不费力地解决了这个问题.问题出在我什么时候go 部署到我的AWS ubuntu box(Nginx).我遵循了所有通常的指示:http://laravelcollective.com/docs/5.1/html#installation

我的提供者和别名是在我从本地推送git时添加的.也许这个文件应该被忽略,并且在服务器上手动进行更改?

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,
    // ...
  ],

I then manually added:

Begin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html.

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

And finally, I ran:

composer.phar update

It was running this command that throws the error:

PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
> php artisan clear-compiled
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Fatal error:  Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line 6



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



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



  [RuntimeException]
  Error Output: PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
  PHP Fatal error:  Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line



update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-auties] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ...

I then tried running php artisan clear-compiled, to see if that would do anything, and got:

PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Fatal error:  Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line 6716



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

I know my nginx ubuntu environment is not the same as a windows xampp env, but I'm still unsure why following the Laravel-provided instructions for adding this don't seem to working. Would greatly appreciate some advice on this.

干杯

推荐答案

When you update your composer it will check the providers. Because you haven't installed laravelcollective/html yet he can't find it and throws an error:

因此,首先需要你的包,然后将它们添加到配置文件中.

You can also work with composer require laravelcollective/html, it will add it to the json file automatically. Then it doesn't matter if you have added them before or not because the config file won't be checked.

Laravel相关问答推荐

如何判断用户是否已登录Laravel

Laravel Eloquent查询与集合优化

V-icon 在 Vuetify 3 中不显示图标

如何在 laravel 中为另一个用户 session()->forget('cart')?

使用正则表达式 laravel 忘记缓存

如何保存/重定向 Laravel Artisan 命令的输出?

如何在 Laravel 的外部 js 文件中包含 csrf_token()?

如何在 laravel 5.2 中显示 500 内部服务器错误页面?

Carbon现在时间错了

如何在 Laravel 4 中使用没有 id 的 Eloquent 更新数据

链接到容器时如何使用主机网络?

Laravel:如何在没有数据库的情况下对用户进行身份验证

错误:您的要求无法解析为一组可安装的软件包.

将 Laravel Socialite 与 API 一起使用?

Laravel 同步错误

Laravel 5 干预中的图像验证

Laravel5如何将数组传递给查看

Laravel Eloquent 多态一对一?

找不到框laravel/homestead

如何从 laravel 5.1 中数据库表的 created_at 属性中 Select 年份和月份?