编写器更新时缺少服务提供者



在必须通过FTP手动部署到缺乏SSH访问的客户端服务器之前,我运行了composer install --no-dev。当我这样做时,我收到了以下错误:

PHP Fatal error:  Class 'WayGeneratorsGeneratorsServiceProvider' not found in C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php on line 158
PHP Stack trace:
PHP   1. {main}() C:wwwtest.devlaravelartisan:0
PHP   2. require_once() C:wwwtest.devlaravelartisan:30
PHP   3. require() C:wwwtest.devlaravelbootstrapstart.php:60
PHP   4. IlluminateFoundationProviderRepository->load() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationstart.php:210
PHP   5. IlluminateFoundationProviderRepository->compileManifest() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php:58
PHP   6. IlluminateFoundationProviderRepository->createProvider() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php:122
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Way\Generators\GeneratorsServiceProvider' not found","file":"C:\Ampps\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRe
pository.php","line":158}}Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

  [RuntimeException]
  Error Output: PHP Fatal error:  Class 'WayGeneratorsGeneratorsServiceProvider' not found in C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php on line 158
  PHP Stack trace:
  PHP   1. {main}() C:wwwtest.devlaravelartisan:0
  PHP   2. require_once() C:wwwtest.devlaravelartisan:30
  PHP   3. require() C:wwwtest.devlaravelbootstrapstart.php:60
  PHP   4. IlluminateFoundationProviderRepository->load() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationstart.php:210
  PHP   5. IlluminateFoundationProviderRepository->compileManifest() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php:58
  PHP   6. IlluminateFoundationProviderRepository->createProvider() C:wwwtest.devlaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php:122

每个app.php文件都有'WayGeneratorsGeneratorsServiceProvider'行。

在运行该composer命令之前,它工作得很好。为什么会发生这种情况,怎样才能解决?

4.1 Laravel。

在您的composer.json文件中,您仅将way/generators作为开发机器依赖项。如果在每个app.php文件中都有服务提供者'WayGeneratorsGeneratorsServiceProvider',那么这意味着way/generators既是开发机器又是部署机器依赖项。通过执行composer install --no-dev,您说的是仅依赖于开发机器的软件包不应该放在vendor目录中,这意味着软件包way/generators没有安装在vendor目录中。这就是为什么你会得到错误。

由于way/generators只是一个开发依赖,您应该从app/config.php中删除'WayGeneratorsGeneratorsServiceProvider',这样部署机器就不会寻找它。

同样,如果你在开发机器上工作并执行composer install --no-dev, way/generators包不会安装在vendor目录中,你会得到上面的错误。因此,您必须将开发机器环境设置为非local,以测试它是否在部署机器中工作。

相关内容

  • 没有找到相关文章

最新更新