Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gatsby源drupal不显示graphql查询_Drupal_Graphql_Gatsby - Fatal编程技术网

gatsby源drupal不显示graphql查询

gatsby源drupal不显示graphql查询,drupal,graphql,gatsby,Drupal,Graphql,Gatsby,我在我的gatsby项目中添加了gatsby源drupal,但是由于某种原因,drupal-查询没有显示在GraphiQL()中 我试过了 gatsby config.js module.exports = { siteMetadata: { title: `Gatsby Default Starter`, description: `Kick off your next, great Gatsby project with this default starter. Thi

我在我的
gatsby
项目中添加了
gatsby源drupal
,但是由于某种原因,
drupal
-查询没有显示在GraphiQL()中

我试过了

gatsby config.js

module.exports = {
  siteMetadata: {
    title: `Gatsby Default Starter`,
    description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
    author: `@gatsbyjs`,
  },
  plugins: [
    {
      resolve: `gatsby-source-drupal`,
      options: {
        baseUrl: `localhost:8000`,
        apiBase: `jsonapi`, // optional, defaults to `jsonapi`
      },
    },
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    }
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
}
比如跑步

{
    allNodeArticle
}
最终在

{
  "errors": [
    {
      "message": "Cannot query field \"allNodeArticle\" on type \"Query\".",
      "locations": [
        {
          "line": 3,
          "column": 2
        }
      ],
      "stack": [
        "GraphQLError: Cannot query field \"allNodeArticle\" on type \"Query\".",
        "    at Object.Field (/app/node_modules/graphql/validation/rules/FieldsOnCorrectType.js:64:31)",
        "    at Object.enter (/app/node_modules/graphql/language/visitor.js:332:29)",
        "    at Object.enter (/app/node_modules/graphql/language/visitor.js:383:25)",
        "    at visit (/app/node_modules/graphql/language/visitor.js:250:26)",
        "    at validate (/app/node_modules/graphql/validation/validate.js:63:22)",
        "    at /app/node_modules/express-graphql/dist/index.js:154:52",
        "    at <anonymous>",
        "    at process._tickCallback (internal/process/next_tick.js:189:7)"
      ]
    }
  ]
}
{
“错误”:[
{
“消息”:“无法查询类型\“查询\”上的字段\“allNodeArticle\”,
“地点”:[
{
"行":3,,
“专栏”:2
}
],
“堆栈”:[
“GraphQLError:无法查询类型\“query\”上的字段\“allNodeArticle\”,
“在Object.Field(/app/node_modules/graphql/validation/rules/FieldsOnCorrectType.js:64:31)”中,
“在Object.enter(/app/node_modules/graphql/language/visitor.js:332:29)”中,
“在Object.enter(/app/node_modules/graphql/language/visitor.js:383:25)”中,
“在访问时(/app/node_modules/graphql/language/visitor.js:250:26)”,
“在验证(/app/node_modules/graphql/validation/validate.js:63:22)”时,
“at/app/node_modules/express graphql/dist/index.js:154:52”,
“在”,
“在进程中._tickCallback(内部/process/next_tick.js:189:7)”
]
}
]
}

您必须在drupal安装上安装
drupal/jsonapi_extras

看起来您指向的是位于localhost:8000的Gatsby开发服务器,而不是drupal实例。您必须指向drupal IP:port/URL:port,它才能工作