telescope: New Installation of Telescope fails

  • Telescope Version: 2.1
  • Laravel Version: 6.0.3
  • PHP Version: 7.3.6
  • Database Driver & Version:

Description:

I upgraded my 5.8 project yesterday to 6 yesterday using Laravel Shift. Everything seems to be fine with that. Installing Telescope (previously uninstalled), however, fails at Publishing Telescope Configuration...

Steps To Reproduce:

  1. composer require laravel/telescope
  2. php artisan telescope:install
  3. Errors with:
Publishing Telescope Service Provider...
Publishing Telescope Assets...
Publishing Telescope Configuration...

   ErrorException  : file_get_contents(/home/vagrant/xxx/app/Providers/TelescopeServiceProvider.php): failed to open stream: No such file or directory

  at /home/vagrant/xxx/vendor/laravel/telescope/src/Console/InstallCommand.php:80
    76|
    77|         file_put_contents(app_path('Providers/TelescopeServiceProvider.php'), str_replace(
    78|             "namespace App\Providers;",
    79|             "namespace {$namespace}\Providers;",
  > 80|             file_get_contents(app_path('Providers/TelescopeServiceProvider.php'))
    81|         ));
    82|     }
    83| }
    84|

  Exception trace:

  1   file_get_contents("/home/vagrant/xxx/app/Providers/TelescopeServiceProvider.php")
      /home/vagrant/xxx/vendor/laravel/telescope/src/Console/InstallCommand.php:80

  2   Laravel\Telescope\Console\InstallCommand::registerTelescopeServiceProvider()
      /home/vagrant/xxx/vendor/laravel/telescope/src/Console/InstallCommand.php:43
  1. App\Providers\TelescopeServiceProvider::class, gets written into app.php but neither the actual service provider nor the migrations are actually created as files.
  2. Using php artisan telescope:publish returns
Publishing complete.
Publishing complete.

(yes, twice like that) but nothing actually changes or gets published.

This is my first time trying to use Telescope and I might be missing something obvious but I’m simply following the instructions and it’s not working, so I’d appreciate any help here.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 18
  • Comments: 35 (2 by maintainers)

Most upvoted comments

I was was having the same issue on Laravel Framework 6.5 and PHP 7.2.24. I ended up following some steps that @HPWebdeveloper had done and was able to run the commands.

  1. php artisan cache:clear
  2. php artisan config:clear
  3. composer require laravel/telescope
  4. php artisan telescope:install

At this point I noticed the App\Providers\TelescopeServiceProvider.php file was now there as well as App\config\telescope.php however I do not see a migrate file anywhere. But when continuing on.

  1. php artisan migrate

This actually runs the migration. But I have no idea where it is coming from…

I’m using the exact same as kvn1234. When running the php artisan telescope:install it gives me

Telescope scaffolding installed successfully

but it says nothing to migrate after going to the next step (running php artisan migrate). Even after removing it etc, I can’t seem to get it to wrok.

Frustrating. I have used this before at the beginning of the year and it was like a 5 minute process to get this thing up and running. Now I am copying files and chasing down errors, and finally got it running after 30 minutes by following steps here:

  1. trying to run php artisan telescope:install and having it fail the first time with an fopen error
  2. running php artisan telescope:install a second time and it appeared to have worked (no errors)
  3. running php artisan migrate and there was nothing to migrate
  4. running php artisan telescope:publish and it said it published it twice
  5. checked the /telescope route and was 404ed
  6. tried running php artisan migrate again and there was nothing to migrate
  7. manually copying the vendor/laravel/telescope/stubs/TelescopeServiceProvider.stub to app/Providers/TelescopeServiceProvider.php
  8. manually copying vendor/laravel/telescope/config/telescope.php to config/telescope.php
  9. manually copying vendor/laravel/telescope/src/Storage/migrations/2018_08_08_100000_create_telescope_entries_table.php to database/migrations/2018_08_08_100000_create_telescope_entries_table.php
  10. checking the provider registration in config/app.php and moving the registration to app/Providers/AppServiceProvider.php from the docs
  11. running php artisan migrate
  12. running php artisan vendor:publish --tag=telescope-assets --force

I am not sure if any of steps 1-4 actually did anything since I copied most everything over on my own.

I got it working by manually copying the TelescopeServiceProvider file to the Providers directory:

cp vendor/laravel/telescope/stubs/TelescopeServiceProvider.stub app/Providers/TelescopeServiceProvider.php

I also added the TELESCOPE_ENABLED=true line to the .env file, just in case.

I am able to install Telescope correctly on a fresh Laravel 6 application.

I fixed this issue like this 1 . Running these commands php artisan cache:clear and php artisan config:clear 2.Then Later Require Telescope composer require laravel/telescope 3.Then Later I run this command php artisan telescope:install

So Basically It WORKED

if you want to remove the package you installed

Run remove command composer remove laravel/telescope then comment or remove the App\Providers\TelescopeServiceProvider::class, In app/Config Folder

This problem is still persisting and I don’t know why it is ignored. It exists. Installation is failing.

Thanks for the support. It worked after running php artisan cache:clear & php artisan config:clear commands.

ty @pszucs 👍

TELESCOPE_ENABLED=true worked for me.

Ran into this issue as well. Clearing caches, then removing line App\Providers\TelescopeServiceProvider::class, from app/config/app.php as others recommended worked because the install command won’t run if that line already exists in the file.

The Cause: For myself the cause was I still had the following in my composer.json:

        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],

This was removed from composer.json in 2017: https://github.com/laravel/laravel/commit/2f4d72699cdc9b7db953055287697a60b6d8b294

I encountered a similar issue, I emptied the bootstrap/cache directory and I re-ran all installation steps. It solved my problem.

Thanks @alecjamesgarcia. This worked for me. Regarding the migration, it comes from the newly added telescope module in the laravel package within vendor.

Hello,

same problem here, i had to copy manually the provider from stubs, and the migration from src/Storage/migrations.

A this point an error of mix manifest occured, and i had to do : php artisan vendor:publish --tag=telescope-assets --force

and now telescope is working, after doing npm run prod