问题
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?
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/58098157/laravel-telescope-failed-to-open-stream-no-such-file-or-directory-telescopeserv