php - Laravel 返回 InvalidArgumentException 并显示消息“没有为 [graphql-playground] 定义提示路径”
问题描述
Lighthouse 教程说如果访问 /graphql-playground 会出现 GraphQL Playground 的视图,但是会抛出异常。我该如何解决?
当访问 /graphql-playground 时,抛出此异常:
InvalidArgumentException(code: 0): No hint path defined for [graphql-playground]
异常从以下位置抛出:
protected function parseNamespaceSegments($name)
{
$segments = explode(static::HINT_PATH_DELIMITER, $name);
if (count($segments) !== 2) {
throw new InvalidArgumentException("View [{$name}] has an invalid name.");
}
if (! isset($this->hints[$segments[0]])) { // <- this line
throw new InvalidArgumentException("No hint path defined for [{$segments[0]}].");
}
return $segments;
}
我试过这个:
- 将 ServiceProvider 添加到 config.app.provider
'providers' => [
//
\MLL\GraphQLPlayground\GraphQLPlaygroundServiceProvider::class,
],
- 发布包
php artisan vendor:publish --tag=graphql-playground-view
php artisan vendor:publish --tag=graphql-playground-config
php artisan vendor:publish --provider="MLL\GraphQLPlayground\GraphQLPlaygroundServiceProvider"
解决方案
推荐阅读
- c# - 替换出现数值的字符串(1000000)应该是十进制格式,例如(1,000,000.00)
- pyinstaller - 我使用 PySimpleGUI 和 cx_oracle 创建了小型桌面应用程序,并创建了无法在另一台机器上运行的 exe
- javascript - 使用 Vue I18n 和大内容文本 html 的最佳方式
- cmd - FTP 响应 150(文件状态正常;即将打开数据连接)挂起?
- kiwi-tcms - 如何开始使用 Kiwi API?
- excel - 对excel中的行组执行操作
- linux - shell脚本中的算术运算
- fullcalendar - Fullcalendar v4 使用反向背景渲染的背景事件颜色错误
- android - 如何在 Android 上对 PCM 音频文件进行下采样
- java - org.eclipse.jetty.util.ssl.SslContextFactory$Client ClassNotFoundException 升级到 Jetty Server 9.4.16