在 Laravel 9 中,执行:php artisan telescope:install 时报错:ERROR There are no commands defined in the “telescope” namespace.
1、在 Laravel 9 中,执行:php artisan telescope:install 时报错:ERROR There are no commands defined in the “telescope” namespace.。如图1
PS E:\wwwroot\erp-backend> php artisan telescope:install ERROR There are no commands defined in the "telescope" namespace.
2、发现应用程序的 config/app.php 配置文件中 TelescopeServiceProvider 服务提供者注册 已经删除。先再次添加回去。如图2
3、再次运行:php artisan telescope:install。不再报错。如图3
PS E:\wwwroot\erp-backend> php artisan telescope:install Publishing Telescope Service Provider... Publishing Telescope Assets... Publishing Telescope Configuration... Telescope scaffolding installed successfully.
4、还原第 2 步骤的操作,在 App\Providers\AppServiceProvider 类的 register 方法中,手动注册 telescope 的服务提供者
/** * 注册应用服务 * * @return void */ public function register() { if ($this->app->environment('local')) { $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); $this->app->register(TelescopeServiceProvider::class); } }
近期评论