【问题标题】:Gatsbyjs + Wordpress GraphQL error `Cannot query field`Gatsbyjs + Wordpress GraphQL 错误`无法查询字段`
【发布时间】:2020-12-04 15:06:58
【问题描述】:

我正在尝试建立一个由 Wordpress CMS 支持的 Gatsby 网站。我正在按照https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/docs/getting-started.md 此处的说明进行操作。

当我尝试在提供的模板上运行 gatsby develop 时,我收到大量关于字段/节点不存在的 GraphQL 错误。几个亮点:

Field "databaseId" is not defined by type WpNodeWithAuthorToUserConnectionEdgeFilterInput.
Cannot read property 'allWpPost' of undefined
Cannot query field "menuItemId" on type "WpMenuItem".
Cannot query field "connectedObject" on type "WpMenuItem".
Cannot query field "remoteFile" on type "WpNodeWithFeaturedImageToMediaItemConnectionEdge".
Cannot query field "firstName" on type "WpNodeWithAuthorToUserConnectionEdge".
Cannot query field "lastName" on type "WpNodeWithAuthorToUserConnectionEdge".
Cannot query field "uri" on type "WpNodeWithAuthorToUserConnectionEdge".
Cannot query field "description" on type "WpNodeWithAuthorToUserConnectionEdge".
Cannot query field "avatar" on type "WpNodeWithAuthorToUserConnectionEdge".
Cannot query field "remoteFile" on type "WpNodeWithFeaturedImageToMediaItemConnectionEdge".

完整日志:

> gatsby develop

info gatsby-source-wordpress

This is either your first build or the cache was cleared.

Please wait while your WordPress data is synced to your Gatsby cache.


Maybe now's a good time to get up and stretch? :D


success gatsby-source-wordpress ingest WPGraphQL schema - 3.255s

success createSchemaCustomization - 10.324s

success gatsby-source-wordpress Category - 1.393s - fetched 1

success gatsby-source-wordpress Comment - 1.408s - fetched 0

success gatsby-source-wordpress ContentType - 1.431s - fetched 3

success gatsby-source-wordpress MenuItem - 1.766s - fetched 0

success gatsby-source-wordpress PostFormat - 2.869s - fetched 0

success gatsby-source-wordpress Tag - 2.890s - fetched 0

success gatsby-source-wordpress Menu - 2.921s - fetched 0

success gatsby-source-wordpress Post - 3.062s - fetched 1

success gatsby-source-wordpress Page - 3.970s - fetched 2

success gatsby-source-wordpress UserRole - 4.136s - fetched 0

success gatsby-source-wordpress Taxonomy - 4.175s - fetched 3

success gatsby-source-wordpress User - 4.195s - fetched 1

success gatsby-source-wordpress MediaItem - 1.886s - fetched 1

success gatsby-source-wordpress creating nodes - 1.895s

success gatsby-source-wordpress fetching nodes - 6.128s - 12 total

success gatsby-source-wordpress fetch root fields - 1.102s

success Downloading remote files - 2.211s - 1/1 0.45/s

success source and transform nodes - 10.207s

success building schema - 0.999s

warn Warning: Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions

warn Warning: Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions

warn Warning: Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions


ERROR #85901 GRAPHQL


There was an error in your GraphQL query:


Field "databaseId" is not defined by type WpNodeWithAuthorToUserConnectionEdgeFilterInput.


File: gatsby-node.js:32:3



ERROR #11321 PLUGIN


"gatsby-node.js" threw an error while running the createPages lifecycle:


Cannot read property 'allWpPost' of undefined


30 | await createBlog(props, { perPage, blogURI })

31 | await createCategories(props, { perPage })

> 32 | await createAuthors(props, { perPage })

| ^

33 | }

34 |

35 | const { createRemoteFileNode } = require(`gatsby-source-filesystem`)


File: gatsby-node.js:32:3




TypeError: Cannot read property 'allWpPost' of undefined


- createAuthors.js:37

/home/node/www/create/createAuthors.js:37:17


- task_queues.js:93 processTicksAndRejections

internal/process/task_queues.js:93:5


- async Promise.all


- createAuthors.js:23 module.exports

/home/node/www/create/createAuthors.js:23:3


- gatsby-node.js:32 Object.exports.createPages

/home/node/www/gatsby-node.js:32:3


- From previous event:


- api-runner-node.js:231 runAPI

[www]/[gatsby]/src/utils/api-runner-node.js:231:22


- api-runner-node.js:339 Promise.catch.decorateEvent.pluginName

[www]/[gatsby]/src/utils/api-runner-node.js:339:17


- From previous event:


- api-runner-node.js:338

[www]/[gatsby]/src/utils/api-runner-node.js:338:14


- timers.js:458 processImmediate

internal/timers.js:458:21


- From previous event:


- api-runner-node.js:330

[www]/[gatsby]/src/utils/api-runner-node.js:330:13


- From previous event:


- api-runner-node.js:246 module.exports

[www]/[gatsby]/src/utils/api-runner-node.js:246:3


- create-pages.ts:21 createPages

[www]/[gatsby]/src/services/create-pages.ts:21:9


- index.ts:48 bootstrap

[www]/[gatsby]/src/bootstrap/index.ts:48:9


- develop-process.ts:112 module.exports

[www]/[gatsby]/src/commands/develop-process.ts:112:53



failed createPages - 0.391s

warn Warning: Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions

warn Warning: Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions

success createPagesStatefully - 0.219s

success updating schema - 0.089s

success onPreExtractQueries - 0.003s


ERROR #85901 GRAPHQL


There was an error in your GraphQL query:


Field "databaseId" is not defined by type WpNodeWithAuthorToUserConnectionEdgeFilterInput.


File: src/templates/archive.js:51:19



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "menuItemId" on type "WpMenuItem".


If you don't expect "menuItemId" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "menuItemId" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "menuItemId" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/MenuModal.js:17:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "connectedObject" on type "WpMenuItem".


If you don't expect "connectedObject" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "connectedObject" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "connectedObject" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/MenuModal.js:18:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "menuItemId" on type "WpMenuItem".


If you don't expect "menuItemId" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "menuItemId" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "menuItemId" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/Menu.js:14:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "connectedObject" on type "WpMenuItem".


If you don't expect "connectedObject" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "connectedObject" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "connectedObject" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/Menu.js:15:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "menuItemId" on type "WpMenuItem".


If you don't expect "menuItemId" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "menuItemId" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "menuItemId" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/SocialMenu.js:72:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "connectedObject" on type "WpMenuItem".


If you don't expect "connectedObject" to exist on the type "WpMenuItem" it is most likely a typo.

However, if you expect "connectedObject" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "connectedObject" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpMenuItem":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/components/SocialMenu.js:73:13



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "remoteFile" on type "WpNodeWithFeaturedImageToMediaItemConnectionEdge".


If you don't expect "remoteFile" to exist on the type "WpNodeWithFeaturedImageToMediaItemConnectionEdge" it is most likely a typo.

However, if you expect "remoteFile" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "remoteFile" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithFeaturedImageToMediaItemConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:132:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "name" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "name" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "name" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "name" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:137:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "firstName" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "firstName" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "firstName" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "firstName" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:138:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "lastName" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "lastName" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "lastName" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "lastName" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:139:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "uri" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "uri" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "uri" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "uri" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:140:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "description" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "description" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "description" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "description" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:141:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "avatar" on type "WpNodeWithAuthorToUserConnectionEdge".


If you don't expect "avatar" to exist on the type "WpNodeWithAuthorToUserConnectionEdge" it is most likely a typo.

However, if you expect "avatar" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "avatar" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithAuthorToUserConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/post.js:142:7



ERROR #85923 GRAPHQL


There was an error in your GraphQL query:


Cannot query field "remoteFile" on type "WpNodeWithFeaturedImageToMediaItemConnectionEdge".


If you don't expect "remoteFile" to exist on the type "WpNodeWithFeaturedImageToMediaItemConnectionEdge" it is most likely a typo.

However, if you expect "remoteFile" to exist there are a couple of solutions to common problems:


- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server

- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have

- You want to optionally use your field "remoteFile" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")


It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "WpNodeWithFeaturedImageToMediaItemConnectionEdge":

https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions


File: src/templates/types/page.js:135:7


failed extract queries from components - 1.396s

success write out redirect data - 0.113s

success Build manifest and related icons - 0.255s

success onPostBootstrap - 0.274s

info bootstrap finished - 29.400s

success run static queries - 0.026s - 2/2 77.74/s

success run page queries - 0.038s - 8/8 208.53/s

success write out requires - 0.016s


ERROR #11321 PLUGIN


"gatsby-plugin-notifications" threw an error while running the onCreateDevServer lifecycle:


Cannot destructure property 'activationValue' of 'undefined' as it is undefined.


45 | timeout: 15,

46 | },

> 47 | function (_err, _response, { activationValue }) {

| ^

48 | if ([`open app`, `open both`].includes(activationValue)) {

49 | open(`http://localhost:8000`)

50 | }


File: node_modules/gatsby-plugin-notifications/gatsby-node.js:47:36




TypeError: Cannot destructure property 'activationValue' of 'undefined' as it is undefined.


- gatsby-node.js:47

[www]/[gatsby-plugin-notifications]/gatsby-node.js:47:36


- notifysend.js:69 NotifySend.notifyRaw

[www]/[node-notifier]/notifiers/notifysend.js:69:12


- gatsby-node.js:37 Object.exports.onCreateDevServer

[www]/[gatsby-plugin-notifications]/gatsby-node.js:37:14


- api-runner-node.js:229 runAPI

[www]/[gatsby]/src/utils/api-runner-node.js:229:22


- api-runner-node.js:339 Promise.catch.decorateEvent.pluginName

[www]/[gatsby]/src/utils/api-runner-node.js:339:17


- api-runner-node.js:338

[www]/[gatsby]/src/utils/api-runner-node.js:338:14


- From previous event:


- api-runner-node.js:330

[www]/[gatsby]/src/utils/api-runner-node.js:330:13


- From previous event:


- api-runner-node.js:246 module.exports

[www]/[gatsby]/src/utils/api-runner-node.js:246:3


- start-server.ts:291 startServer

[www]/[gatsby]/src/utils/start-server.ts:291:9


- start-webpack-server.ts:35 startWebpackServer

[www]/[gatsby]/src/services/start-webpack-server.ts:35:57


- develop-process.ts:140 module.exports

[www]/[gatsby]/src/commands/develop-process.ts:140:3



⠀

info gatsby-source-wordpress Watching for WordPress changes

⠀

You can now view www.mysite.com in the browser.

⠀

http://localhost:8000/

⠀

View GraphiQL, an in-browser IDE, to explore your site's data and schema

⠀

http://localhost:8000/___graphql

⠀

Note that the development build is not optimized.

To create a production build, use gatsby build

⠀

success Building development bundle - 9.886s

Wordpress 似乎运行良好。我可以使用 Wordpress 管理区域中的 WP GraphiQL 界面访问和查询 GraphQL。

Wordpress + 插件

Wordpress 5.4.2
Advanced Custom Fields PRO Version 5.8.12   
WP Gatsby Version 0.4.16
WP GraphiQL Version 1.0.1   
WP GraphQL Version 0.12.0
WP Offload Media Lite Version 2.4.1
WPGraphQL for Advanced Custom Fields Version 0.3.3

注意,WP GraphQL 版本在 WordPress 插件页面中列出时显示为0.12.0,但我从0.12.1 版本from the documentation 中获取了文件。我怀疑这只是项目所有者没有更新源代码中的版本号的疏忽。

package.json

{
  "name": "www.mysite.com",
  "private": true,
  "description": "site description",
  "version": "0.0.1",
  "author": "Me",
  "dependencies": {
    "dotenv": "8.2.0",
    "gatsby": "2.24.47",
    "gatsby-image": "2.4.16",
    "gatsby-plugin-chakra-ui": "0.1.4",
    "gatsby-plugin-manifest": "2.4.23",
    "gatsby-plugin-netlify-cache": "1.2.0",
    "gatsby-plugin-notifications": "0.0.2",
    "gatsby-plugin-offline": "3.2.23",
    "gatsby-plugin-react-helmet": "3.3.10",
    "gatsby-plugin-react-svg": "3.0.0",
    "gatsby-plugin-sharp": "2.6.27",
    "gatsby-plugin-typescript": "2.4.18",
    "gatsby-source-filesystem": "2.3.24",
    "gatsby-source-graphql": "2.7.1",
    "gatsby-source-wordpress-experimental": "1.3.6",
    "gatsby-transformer-sharp": "2.5.13",
    "prop-types": "15.7.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-helmet": "6.1.0"
  },
  "devDependencies": {
    "@babel/core": "7.11.0",
    "@babel/preset-env": "7.11.0",
    "@babel/preset-typescript": "7.10.4",
    "@testing-library/jest-dom": "4.2.4",
    "@testing-library/react": "9.5.0",
    "@types/jest": "26.0.8",
    "@types/node": "14.0.27",
    "@types/react": "16.9.43",
    "@types/react-dom": "16.9.8",
    "@types/react-helmet": "6.0.0",
    "@types/react-test-renderer": "16.9.2",
    "@typescript-eslint/eslint-plugin": "3.7.1",
    "@typescript-eslint/parser": "3.7.1",
    "babel-jest": "24.9.0",
    "babel-preset-gatsby": "0.1.11",
    "eslint": "7.5.0",
    "eslint-config-prettier": "6.11.0",
    "eslint-plugin-prettier": "3.1.4",
    "eslint-plugin-react": "7.20.5",
    "identity-obj-proxy": "3.0.0",
    "jest": "26.2.2",
    "prettier": "2.0.5",
    "react-test-renderer": "16.13.1",
    "ts-jest": "26.1.4",
    "typescript": "3.9.7"
  },
  "scripts": {
    "build": "gatsby build",
    "clean": "gatsby clean",
    "develop": "gatsby develop",
    "develop-docker": "gatsby develop -H 0.0.0.0",
    "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
    "lint": "eslint **/*.tsx",
    "start": "gatsby develop",
    "serve": "gatsby serve",
    "test": "jest",
    "test-watch": "jest --watchAll",
    "type-check": "tsc --noEmit"
  }
}

任何想法为什么在入门工具包中引用了这些字段,但未定义从 GraphQL 返回?

【问题讨论】:

    标签: wordpress gatsby


    【解决方案1】:

    对于未来的 Google 探索者,menuItemId 现在似乎是 databaseIdmenuItems 集合中的项目上。此外,像 featuredImage 这样的项目现在将其详细信息(例如:altTexttitle 等)嵌套在其下方的嵌套 node 中。

    很遗憾,我无法回答您看到的其余错误,但我建议您运行 gatsby develop,然后访问 http://localhost:8000/__graphql 并浏览查询的节点以找出新的映射。

    【讨论】:

      猜你喜欢
      • 2019-06-11
      • 2016-03-03
      • 2018-06-30
      • 2020-02-28
      • 2021-04-10
      • 2021-10-07
      • 2020-02-19
      • 2017-07-27
      • 1970-01-01
      相关资源
      最近更新 更多