Laravel Telescope Failed to open stream: no such file or directory TelescopeServiceProvider.php
Asked Answered
C

3

9

I am trying to use the Telescope package from Laravels official documentation and I followed the first 2 steps:

composer require laravel/telescope

and

php artisan telescope:install

Everything went fine in my command line untill the install. I got the error:

ErrorException : file_get_contents(path\app\Providers/TelescopeServiceProvider.php: failed to open stream: No such file or directory at: vendor\laravel\telescope\src\Console\InstallCommand.php

So, of course, I googled the issue and found this and I checked to see if my provider's folder exists. It does and indeed the TelescopeServiceProvider.php is not there. I tried to run the command php artisan telescope:install again and it provided me the message:

Telescope scaffolding installed successfully.

which I thought was strange but ok, I went to the next step of the documentation:

  • After installing the Telescope, you should also run the migrate command: php artisan migrate

So I ran that command and I got the message:

Nothing to migrate.

So obviously this didn't go right. I checked after the "fake" installed successfully message if the TelescopeServiceProvider exists now but it still didn't.

What did I do wrong and how do I fix this issue?

Curable answered 25/9, 2019 at 12:15 Comment(3)
I think that the telescope installation failed and for some reason (maybe permissions?) Laravel couldn't create the TelescopeServiceProvider class in your app/Providers folder... Remove the package, run a composer update and run the process again (require -> install)... If after the php artisan telescope:install you don't see the provider class, the assets inside public folder and the config file than there's a problem with filesystem permission IMHOWomanhater
You can try to download the missing service provider from github, add it to the Providers directory manually and then run telescope:install.Bawl
github.com/laravel/telescope/issues/732#issuecomment-542988625 Other people addressing the issueCurable
M
5

Try update Telescope,

composer update --prefer-source

Try removing Telescope and then reinstalling the package as the installation seems to have broken the package:

composer remove laravel/telescope
composer require laravel/telescope

Try:

composer dump-autoload

or:

artisan cache:clear

after you update or make changes to composer.json to refresh everything.

Maice answered 25/9, 2019 at 12:18 Comment(13)
This still doesn't do anything for me. I still have nothing to migrate after installing telescope. It seems as if the install went wrong but it still proceeded.Curable
@Curable what if you fire composer update --prefer-source?Maice
@Curable OK. So remove Telescope: composer remove laravel/telescope and then reinstall it: composer require laravel/telescope. Make sure you have the correct permissions to modify the files.Maice
Nope. I reinstalled it, but it's still giving me the nothing to migrate messageCurable
This time there weren't any errors no. It really seems as if the first time messed everything up.Curable
Then I'd suggest removing vendor and reinstalling all the packages. But, make a backup, just in case.Maice
Please verify if there is a telescope record in your migrations table? If so, remove it before reinstalling.Bawl
@BramVerstraten There is no telescope record in my migrations table.Curable
@Curable your migrations might be out of sync, copy your db, then run php artisan migrate:fresh.Maice
Thats not the issue though since there is not even a migration after the telescope install when there is supposed to be something to migrate as the documentation states.Curable
Please verify your composer phar with composer diagnose. Update when needed with composer self-update.Bawl
@BramVerstraten composer diagnose gives me all OK. Nothing wrong thereCurable
Hello the composer dump-auto will fix the problem right now.Extended
U
1

Per the Telescope Github Issues

Telescope is not ready for Laravel 6 yet. Many people are having this same issue. The solution is to look at this issue. Although it is a workaround, not a solution.

Underrate answered 17/10, 2019 at 15:47 Comment(0)
C
0

use composer dump-autoload

and:

artisan cache:clear

but

install composer require brick/math

its work

Chickenlivered answered 5/1, 2021 at 5:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.