laravel 在 ProviderRepository.php 第 208 行中找不到提供者类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53672906/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:11:58  来源:igfitidea点击:

Provider Class not found In ProviderRepository.php line 208

phplaravelcomposer-php

提问by Moaiz

I tried to uninstall the spatie/Geocoder Package https://github.com/spatie/geocoderit from my laravel application, it pulled the package from Github but the package uninstallation was not successful.

我试图 从我的 Laravel 应用程序中卸载 spatie/Geocoder 包 https://github.com/spatie/geocoder它,它从 Github 中提取了包,但包卸载没有成功。

Below is the Error that is returned by composer command

下面是 composer 命令返回的错误

Terminal Screenshort:

终端截图:

enter image description here

在此处输入图片说明

Thanks In advance

提前致谢

回答by Moaiz

Issue is resolved by just follow these step. Go to your project > bootstrap->cache->config.php remove the provider and aliases from the cached array manually.

只需按照以下步骤即可解决问题。转到您的项目 > bootstrap->cache->config.php 手动从缓存数组中删除提供程序和别名。

回答by brucelin

I got the same problem on my previous laravel project.

我在之前的 Laravel 项目中遇到了同样的问题。

Try first an:

首先尝试:

service apache2 restart

Or any similar command depending on your OS, e.g. I restarted my wamp server.

或任何类似的命令取决于您的操作系统,例如我重新启动了我的 wamp 服务器。

then on your Laravel folder :

然后在你的 Laravel 文件夹中:

composer dump-autoload

hope it helps.

希望能帮助到你。

回答by louis_coetzee

I ran into this exact same issue. I tried dump-autoload, clear config and more and nothing worked. In the end I went and removed the config.php from bootstrap/cache and then ran composer dump-autoload. That worked.

我遇到了这个完全相同的问题。我尝试了转储自动加载、清除配置等,但没有任何效果。最后,我从 bootstrap/cache 中删除了 config.php,然后运行了 composer dump-autoload。那行得通。

回答by Arthur Samarcos

Remove the lines below:

删除下面的行:

// config/app.php
'providers' => [
    '...',
    Spatie\Geocoder\GeocoderServiceProvider::class
];
// config/app.php
'aliases' => array(
    ...
    'Geocoder' => Spatie\Geocoder\Facades\Geocoder::class,
)

Run 'composer du' in your server console.

在您的服务器控制台中运行“composer du”。

回答by Peter Drinnan

Easiest thing for me was to just delete the files in /bootstrap/cache/. Those will get regenerated automatically.

对我来说最简单的事情就是删除 /bootstrap/cache/ 中的文件。这些将自动重新生成。

回答by fatemeh sadeghi

first check composer.json file, under the psr-4 key from autoload section ,you can define a mapping from namespaces to paths, relative to the package root.

首先检查 composer.json 文件,在 autoload 部分的 psr-4 键下,您可以定义从命名空间到路径的映射,相对于包根目录。

   {
"autoload": {
    "psr-4": {
         "Spatie\Geocoder\": "src" //<<---For example, in your case, this mapping should be done
    }
}

}

}

and then run the following command to regenerates the list of all classes that need to be included in the project

然后运行以下命令重新生成项目中需要包含的所有类的列表

composer dump-autoload

for more information and example look at this link https://getcomposer.org/doc/04-schema.md#autoload

有关更多信息和示例,请查看此链接 https://getcomposer.org/doc/04-schema.md#autoload