Wordpress架构未出现在Gatsby/__图形QL端点处
我正试图建立盖茨比创建一个无头Wordpress网站。我已经建立了本地Wordpress环境,并安装了以下插件并处于活动状态:Wordpress架构未出现在Gatsby/__图形QL端点处,wordpress,graphql,gatsby,headless-cms,Wordpress,Graphql,Gatsby,Headless Cms,我正试图建立盖茨比创建一个无头Wordpress网站。我已经建立了本地Wordpress环境,并安装了以下插件并处于活动状态: ACF:5.9.5 ACF Pro 5.8.12 WP GraphiQL 1.0.1 WP图1.3.5 WP 图Ql Gutenberg 0.3.8 WP GraphQL Gutenberg ACF 0.3.0 高级自定义字段的WPGraphQL 0.4.1 在Wordpress端,一切似乎都按预期进行。我现在一直在尝试设置我的本地Gatsby站点,使用Gatsby
- ACF:5.9.5
- ACF Pro 5.8.12
- WP GraphiQL 1.0.1
- WP图1.3.5 WP
- 图Ql Gutenberg 0.3.8
- WP GraphQL Gutenberg ACF 0.3.0
- 高级自定义字段的WPGraphQL 0.4.1
http://localhost:8000/___graphql/
这是我的gatsby config.js
:
module.exports = {
siteMetadata: {
title: "Portfolio Site",
},
plugins: [
{
resolve: "gatsby-source-graphql",
options: {
typeName: "WPGraphQL",
fieldName: "wpgraphql",
url: "http://local.test/graphql",
refetchInterval: 60,
},
},
],
};
下面是我的包.json的内容:
{
"name": "portfolio-site",
"version": "1.0.0",
"private": true,
"description": "Portfolio Site",
"author": "jsaget",
"keywords": [
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean"
},
"dependencies": {
"@fontsource/syne-mono": "^4.2.2",
"gatsby": "^2.32.3",
"gatsby-source-graphql": "^2.14.0",
"gatsby-source-wordpress": "^4.0.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"typewriter-effect": "^2.17.0"
}
}
当我在终端中运行npm run develope
以启动本地盖茨比时,控制台中出现以下错误和警告:
ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
warn The gatsby-source-graphql plugin has generated no Gatsby nodes. Do you need it?
一位同事以与我完全相同的方式(所有依赖项的相同版本等)设置了这个盖茨比环境,它在他的机器上运行良好,但在我的机器上运行不好。一些全球npm模块或其他东西会干扰吗?或者是Wordpress端的什么东西
为了更加清晰,我希望这里会出现一个下拉字段,标题为wpgraphql
(如gatsby config.js
):
这里也一样,但我发现了一些东西
转到WordPress dashboard>GraphQL>Settings:
勾选“启用GraphQL调试模式”框
返回您的终端:
通过清洁,然后npm运行开发
wpgraphql现在应该出现在http://localhost:8000/___graphql内部游乐场具有管理员权限。。。外部检查API-使用邮递员。。。为什么不使用gatsby-source-wordpress
?为什么不按照前面的建议使用gatsby-source-wordpress
?第一次设置gatsby项目,我一直在遵循本教程,该教程建议使用gatsby-source-graphql
: