Error there are no commands defined in the “teleScope” namespace in Laravel 9.
1. In Laravel 9, when executing: php artisan telescope:install error: error there are no commands defined in the “teleScope” namespace.. as shown in Figure 1
PS E:\wwwroot\erp-backend> php artisan telescope:install
ERROR There are no commands defined in the "telescope" namespace.
2. Discover the config/app.php configuration file of the TeleScopeServiceProvider service provider in the application configuration file that has been deleted. Add it back first. as shown in Figure 2
3. Run again: php artisan telescope:install. No more errors. as shown in Figure 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. Restore the operation of step 2, in the Register method of the App\Providers\AppServiceProvider class, manually register the service provider of TeleScope
/**
* 注册应用服务
*
* @return void
*/
public function register()
{
if ($this->app->environment('local')) {
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
$this->app->register(TelescopeServiceProvider::class);
}
}


