【发布时间】:2020-07-26 07:23:13
【问题描述】:
我目前正在尝试将 Sentry 添加到我的 Laravel 项目中,但是当我这样做时遇到了这个问题
composer require sentry/sentry-laravel.
我遇到的错误是:
@php artisan package:discover --ansi
Error
Class 'Sentry\ClientBuilder' not found
at vendor/sentry/sentry-laravel/src/Sentry/Laravel/ServiceProvider.php:122
118| ],
119| $userConfig
120| );
121|
> 122| $clientBuilder = ClientBuilder::create($options);
123|
124| // Set the Laravel SDK identifier and version
125| $clientBuilder->setSdkIdentifier(Version::SDK_IDENTIFIER);
126| $clientBuilder->setSdkVersion(Version::SDK_VERSION);
• Database name seems incorrect: You're using the default database name `homestead`. This database does not exist.
Edit the `.env` file and use the correct database name in the `DB_DATABASE` key.
https://laravel.com/docs/master/database#configuration
我的 .env 文件
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Laravel 版本:7.5.2
我正在通过 Homestead 运行所有内容,并且我的数据库确实存在并且项目正在运行,但我无法弄清楚为什么会出现此错误。
提前感谢您的帮助!
【问题讨论】:
-
试试 composer require sentry/sentry-laravel:1.7.0 (docs.sentry.io/platforms/php/laravel)
-
不幸的是,我得到了同样的错误。
-
这很奇怪。你有文件夹供应商/哨兵吗?如果是,删除它,运行 composer self-update 然后 composer require
-
很遗憾,还是没有成功