在ProviderRepository.php第208行:找不到类'Sentry \ SentryLaravel \ SentryLaravelServiceProvider'

时间:2019-07-17 15:16:44

标签: laravel-5 sentry

我正在尝试将Sentry Error Tracking安装到我的Laravel 5项目中。当我尝试使用命令发布提供程序时会抛出错误

php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"

我将此添加到config / app.php

'providers' => array(
    // ...
    Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
)

'aliases' => array(
    // ...
    'Sentry' => Sentry\SentryLaravel\SentryFacade::class,
)

然后我跑了

php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"

它引发了错误

In ProviderRepository.php line 208:
Class 'Sentry\SentryLaravel\SentryLaravelServiceProvider' not found

我一直在寻找各种解决方案,但是没有一个对我有用。这对我的项目非常重要。请给我一些帮助。谢谢。

1 个答案:

答案 0 :(得分:0)

我推荐官方哨兵文件。 https://sentry.io/for/laravel/

不确定您的确切开发环境是什么(操作系统,PHP版本,laravel版本等)。

这是您可以检查的内容。

  1. 检查已安装的哨兵laravel软件包。如果未安装,请使用next命令进行安装。
composer require sentry/sentry-laravel
  1. 从composer.json检查sendry / sentry-laravel的版本。 在版本1.x名称空间更改为
  2. 后,请注意
'providers' => array(
    Sentry\Laravel\ServiceProvider::class,
)

'aliases' => array(
    'Sentry' => Sentry\Laravel\Facade::class,
)

命名空间更新

版本0.x

Sentry\SentryLaravel\SentryLaravelServiceProvider::class

https://github.com/getsentry/sentry-laravel/blob/0.10.1/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php

版本1.x

Sentry\Laravel\ServiceProvider::class

https://github.com/getsentry/sentry-laravel/blob/1.0.0/src/Sentry/Laravel/ServiceProvider.php