New Installation of Laravel Telescope fails

Introduction:

First you should know, when you run php artisan install:telescope App\Providers\TelescopeServiceProvider::class is added to config/app.php and TelescopeServiceProvider inside the app/providers/ directory and to uninstall temporary the Laravel Telescope you should comment out that line in the config/app.php. Also there is a telescope.php in config folder which you can put false to disable it if you don’t want completely remove its serviceprovider.

'enabled' => env('TELESCOPE_ENABLED', false),

Issue:

Now lets deal with the error that you want to know the solution:

As you see I had a problem in installation Laravel Telescope in Laravel Framework 6.4.1

So I did:

php artisan cache:clear
and
php artisan config:clear

I started again from “composer require …” and I understood I couldn’t run again:

composer require laravel/telescope

Just because of another new error:

In ProviderRepository.php line 208:

Class ‘App\Providers\TelescopeServiceProvider’ not found

I found the only change after the last installation command (I mean this):

php artisan telescope:install

was this new line in config/app.php file:

App\Providers\TelescopeServiceProvider::class,

That causes the error and it seems the installation was not complete and only that line was added!

So I commented that line in config/app.php file and

php artisan cache:clearphp artisan config:clear

again ran :

php artisan telescope:install

It was successful!

I also was surprised that this line:

App\Providers\TelescopeServiceProvider::class,

was not added again after the second try of installation command.

So I manually uncommented that line in config/app.php

and then

php artisan cache:clearphp artisan config:clear

and follow the official document for additional configs.

Now everything is fine and works well! Clapp it and follow me if this article is useful for you, I daily publish article about Laravel.

To remove Laravel Telescope completely :

You must first remove all the telescope reference in your code before running composer remove laravel/telescope.
  1. Check config/app.php, under providers array, remove the Telescope there.
  2. In your app/Providers/AppServiceProvider.php is there a TelescopeServiceProvider there? Remove that also.
  3. Remove telescope.php in config folder
  4. Remove public/vendor/telescope
  5. Also have to remove bootstrap/cache/config.php to get rid of cache link to TelescopeServiceProvider

Then finally you can run composer remove laravel/telescope.

Posting daily about Python, Nuclear Physicist PhD