1. In Laravel 9, running `php artisan telescope:install` throws an error: ERROR There are no commands defined in the “telescope” namespace. See Figure 1.

Plaintext
PS E:\wwwroot\erp-backend> php artisan telescope:install
ERROR There are no commands defined in the "telescope" namespace.
2. I found that the TelescopeServiceProvider service provider registration had been removed from the application’s config/app.php configuration file. I added it back first. See Figure 2.

3. Run `php artisan telescope:install` again. No more errors. See Figure 3.

Plaintext
PS E:\wwwroot\erp-backend> php artisan telescope:install
Publishing Telescope Service Provider...
Publishing Telescope Assets...
Publishing Telescope Configuration...
Telescope scaffolding installed successfully.
4. Revert the operation from step 2, and manually register the Telescope service provider in the register method of the App\Providers\AppServiceProvider class.
PHP
/**
* 注册应用服务
*
* @return void
*/
public function register()
{
if ($this->app->environment('local')) {
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
$this->app->register(TelescopeServiceProvider::class);
}
}
