1. Error in Laravel 6: Target[Interface]Is not instantiable while building[Resolver]. as shown in Figure 1
![在 Laravel 6 中报错:Target [Interface] is not instantiable while building [Resolver]](https://www.shuijingwanwq.com/wp-content/uploads/2022/04/1-7.png)
{
"message": "Target [Modules\\ThemeSetting\\Schema\\ThemeConfigLoaderInterface] is not instantiable while building [Modules\\ThemeStore\\Resolver\\OnlineStoreThemeResolver].",
"exception": "Illuminate\\Contracts\\Container\\BindingResolutionException",
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 978,
"trace": [
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 812,
"function": "notInstantiable",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 681,
"function": "build",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php",
"line": 785,
"function": "resolve",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 629,
"function": "resolve",
"class": "Illuminate\\Foundation\\Application",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php",
"line": 770,
"function": "make",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 945,
"function": "make",
"class": "Illuminate\\Foundation\\Application",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 873,
"function": "resolveClass",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 834,
"function": "resolveDependencies",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 681,
"function": "build",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php",
"line": 785,
"function": "resolve",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 629,
"function": "resolve",
"class": "Illuminate\\Foundation\\Application",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php",
"line": 770,
"function": "make",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\helpers.php",
"line": 120,
"function": "make",
"class": "Illuminate\\Foundation\\Application",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Utils.php",
"line": 58,
"function": "app"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\Directives\\FieldDirective.php",
"line": 45,
"function": "constructResolver",
"class": "Nuwave\\Lighthouse\\Support\\Utils",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\Factories\\FieldFactory.php",
"line": 68,
"function": "resolveField",
"class": "Nuwave\\Lighthouse\\Schema\\Directives\\FieldDirective",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\TypeRegistry.php",
"line": 369,
"function": "handle",
"class": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Type\\Definition\\UnresolvedFieldDefinition.php",
"line": 39,
"function": "Nuwave\\Lighthouse\\Schema\\{closure}",
"class": "Nuwave\\Lighthouse\\Schema\\TypeRegistry",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Type\\Definition\\TypeWithFields.php",
"line": 45,
"function": "resolve",
"class": "GraphQL\\Type\\Definition\\UnresolvedFieldDefinition",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Type\\Definition\\TypeWithFields.php",
"line": 33,
"function": "findField",
"class": "GraphQL\\Type\\Definition\\TypeWithFields",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\Rules\\OverlappingFieldsCanBeMerged.php",
"line": 256,
"function": "getField",
"class": "GraphQL\\Type\\Definition\\TypeWithFields",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\Rules\\OverlappingFieldsCanBeMerged.php",
"line": 165,
"function": "internalCollectFieldsAndFragmentNames",
"class": "GraphQL\\Validator\\Rules\\OverlappingFieldsCanBeMerged",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\Rules\\OverlappingFieldsCanBeMerged.php",
"line": 96,
"function": "getFieldsAndFragmentNames",
"class": "GraphQL\\Validator\\Rules\\OverlappingFieldsCanBeMerged",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\Rules\\OverlappingFieldsCanBeMerged.php",
"line": 64,
"function": "findConflictsWithinSelectionSet",
"class": "GraphQL\\Validator\\Rules\\OverlappingFieldsCanBeMerged",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Language\\Visitor.php",
"line": 414,
"function": "GraphQL\\Validator\\Rules\\{closure}",
"class": "GraphQL\\Validator\\Rules\\OverlappingFieldsCanBeMerged",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Language\\Visitor.php",
"line": 470,
"function": "GraphQL\\Language\\{closure}",
"class": "GraphQL\\Language\\Visitor",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Language\\Visitor.php",
"line": 277,
"function": "GraphQL\\Language\\{closure}",
"class": "GraphQL\\Language\\Visitor",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\DocumentValidator.php",
"line": 224,
"function": "visit",
"class": "GraphQL\\Language\\Visitor",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Validator\\DocumentValidator.php",
"line": 116,
"function": "visitUsingRules",
"class": "GraphQL\\Validator\\DocumentValidator",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
"line": 153,
"function": "validate",
"class": "GraphQL\\Validator\\DocumentValidator",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
"line": 94,
"function": "promiseToExecute",
"class": "GraphQL\\GraphQL",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 268,
"function": "executeQuery",
"class": "GraphQL\\GraphQL",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 203,
"function": "executeParsedQuery",
"class": "Nuwave\\Lighthouse\\GraphQL",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 162,
"function": "parseAndExecuteQuery",
"class": "Nuwave\\Lighthouse\\GraphQL",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 121,
"function": "executeOperation",
"class": "Nuwave\\Lighthouse\\GraphQL",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Utils.php",
"line": 99,
"function": "Nuwave\\Lighthouse\\{closure}",
"class": "Nuwave\\Lighthouse\\GraphQL",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 120,
"function": "applyEach",
"class": "Nuwave\\Lighthouse\\Support\\Utils",
"type": "::"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Controllers\\GraphQLController.php",
"line": 32,
"function": "executeOperationOrOperations",
"class": "Nuwave\\Lighthouse\\GraphQL",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php",
"line": 48,
"function": "__invoke",
"class": "Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 219,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 176,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 681,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 130,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Middleware\\AttemptAuthentication.php",
"line": 34,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AttemptAuthentication",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Middleware\\AcceptJson.php",
"line": 27,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AcceptJson",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 105,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 683,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 658,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 624,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 613,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 170,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 130,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php",
"line": 67,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\app\\Http\\Middleware\\ChangeAppUrlMiddleware.php",
"line": 23,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "App\\Http\\Middleware\\ChangeAppUrlMiddleware",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php",
"line": 63,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\fideloper\\proxy\\src\\TrustProxies.php",
"line": 57,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\dingo\\api\\src\\Http\\Middleware\\Request.php",
"line": 111,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"function": "handle",
"class": "Dingo\\Api\\Http\\Middleware\\Request",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 105,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 145,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 110,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "E:\\wwwroot\\object\\public\\index.php",
"line": 57,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
}
]
}
2. View git logs, analyze /modules/themestore/providers/themestoreServiceProvider.php, send Now there is a shared binding registered in the container: ThemeConfigLoaderInterface::Class, but now it does not exist. as shown in Figure 2

$this->app->singleton(ThemeConfigLoaderInterface::class, function($app) {
if ($this->app['config']['theme_store.view_storage'] == 'database') {
return new DbThemeSchemaLoader($app->make(ThemeBuilder::class), $app->make(ThemeSettingBuilder::class), $app->make(ViewStorageInterface::class));
} else {
return new FileThemeSchemaLoader($app->make('igaster.themes'), $app->make(ThemeBuilder::class), $app->make(ThemeSettingBuilder::class));
}
});
$this->app->singleton(ThemeConfigSourceInterface::class, function($app) {
if ($this->app['config']['theme_store.view_storage'] == 'database') {
return new ThemeConfigDbSource($app->make(ViewStorageInterface::class), $this->app['files'], $this->app['config']['view.compiled']);
} else {
return new ThemeConfigFileSource($app->make('igaster.themes'));
}
});
3. Finally found this shared binding: ThemeConfigLoaderInterface::Class has been moved to /modules/themesetting/providers/themesettingServiceProvider.php
$this->app->singleton(ThemeConfigLoaderInterface::class, function ($app) {
return new ThemeConfigLoader($app->make(ThemeBuilder::class), $app->make(ThemeSettingBuilder::class), $app->make(RawThemeConfigProvider::class));
});
4. Edit /config/app.php, add ThemeSettingServiceProvider::Class before ThemeStoreServiceProvider::Class
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Modules\ThemeSetting\Providers\ThemeSettingServiceProvider::class,
Modules\ThemeStore\Providers\ThemeStoreServiceProvider::class,
],
5. Request again, respond to 200. as shown in Figure 3

需要长期技术维护或远程问题排查?
我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。
如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:
- ✅ PHP / Laravel / Yii2 老项目无人维护
- ✅ Go / Gin 后端接口需要排查或优化
- ✅ WordPress 网站访问慢、报错或插件冲突
- ✅ Nginx / MySQL / Redis / Linux 服务器异常
- ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
- ✅ 需要长期远程技术支持或兼职维护
更多介绍请查看:关于我 & 合作
微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan

![在 Laravel 6 中报错:Target [Interface] is not instantiable while building [Resolver]](https://media.shuijingwanwq.com/2022/04/1-7.png)
发表回复