首页 > 解决方案 > Laravel Telescope 无法打开流:没有这样的文件或目录 TelescopeServiceProvider.php

问题描述

我正在尝试使用Laravel 官方文档中的 Telescope 包,我遵循了前两个步骤:

composer require laravel/telescope

php artisan telescope:install

在安装之前,我的命令行中一切正常。我得到了错误:

ErrorException:file_get_contents(path\app\Providers/TelescopeServiceProvider.php:无法打开流:没有这样的文件或目录:vendor\laravel\telescope\src\Console\InstallCommand.php

所以,当然,我搜索了这个问题并找到了这个,然后我检查了我的提供者的文件夹是否存在。它确实存在,而且确实TelescopeServiceProvider.php不存在。我尝试php artisan telescope:install再次运行该命令,它为我提供了以下消息:

望远镜脚手架安装成功。

我认为这很奇怪,但没关系,我进入了文档的下一步:

所以我运行了那个命令,我得到了消息:

没有什么可以迁移的。

所以很明显这不正确。如果 TelescopeServiceProvider 现在存在,我在“假”安装成功消息后检查了它,但它仍然不存在。

我做错了什么,我该如何解决这个问题?

标签: phplaravellaravel-6

解决方案


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.


推荐阅读