Node.js 盖茨比节点api未给出值“;fileAbsolutePath“;

Node.js 盖茨比节点api未给出值“;fileAbsolutePath“;,node.js,reactjs,graphql,Node.js,Reactjs,Graphql,我在我的个人网站上工作,我在那个文件夹上创建了“博客帖子”,我创建了“降价”文件。所以我可以使用graphql抓取 我使用了盖茨比节点api“onCreateNode”。你可以在这里查看 所以,这里我想从“fileAbsolutePath”创建slug,但我没有得到这个值 我尝试了很多在互联网上找到的东西,但我不知道为什么我得不到这个价值 gatsby-node.js module.exports.onCreateNode = ({ node, getNode, actions }) =>

我在我的个人网站上工作,我在那个文件夹上创建了“博客帖子”,我创建了“降价”文件。所以我可以使用graphql抓取

我使用了盖茨比节点api“onCreateNode”。你可以在这里查看

所以,这里我想从“fileAbsolutePath”创建slug,但我没有得到这个值

我尝试了很多在互联网上找到的东西,但我不知道为什么我得不到这个价值

gatsby-node.js

module.exports.onCreateNode = ({ node, getNode, actions }) => {
  const { createNodeField } = actions
  if (node.internal.type === "MarkdownRemark") {
    console.log(node)
  }
}
gatsby-config.js

plugins: [
    {
      resolve: "gatsby-source-contentful",
      options: {
        spaceId: process.env.CONTENTFUL_SPACE_ID,
        accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
      },
    },
    `gatsby-plugin-sass`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: "src",
        path: `${__dirname}/src/`,
      },
    },
以下是输出:

{ id: '6b90d4a1-db96-5809-8900-60c21083d9ff',
  children: [],
  parent: '1ab34b1c-85e4-5f4c-a66e-561a4a95a886',
  internal:
   { content:
      'component is reusable by code which import anywhere and we can render anywhere in reactjs\r\n\r\nprops is just values which is passed from
parents\r\n\r\n',
     type: 'MarkdownRemark',
     contentDigest: '30b988e32ce51560a54006c3ec1829d0',
     owner: 'gatsby-transformer-remark' },
  frontmatter: { title: 'what is component and props', date: '19-02-2019' },
  excerpt: '',
  rawMarkdownBody:
   'component is reusable by code which import anywhere and we can render anywhere in reactjs\r\n\r\nprops is just values which is passed from
parents\r\n\r\n',
{ id: '5c79b3ff-4bcb-5a8b-bfa6-875f8c07a2b2',
  children: [],
  parent: 'c8cbb364-5455-5edc-bb73-5ffd0db1e9e7',
  internal:
   { content: '![DECENTROS](./decentros.jpg)',
     type: 'MarkdownRemark',
     contentDigest: '63c70587a28430a2df8b1ab1788863a6',
     owner: 'gatsby-transformer-remark' },
  frontmatter:
   { title: 'Decentros',
     description:
      'Decentros is the simple react web application.in which you can see the price of any cryptocurrency.in this web app i used api which is called
coinmarket which is really awesome.this is app is deployed on heroku.',
     link: 'http://decentros.herokuapp.com/',
     github: 'https://github.com/yashrajb/Decentros',
     download: '' },
  excerpt: '',
  rawMarkdownBody: '![DECENTROS](./decentros.jpg)',
  fileAbsolutePath:
{ id: '0f0f273f-3fae-51ae-9870-cafa98ec236b',
  children: [],
  parent: 'b5162009-6b12-5356-81e6-9cf9cd422c5e',
  internal:
   { content: '![DECENTROS](./devblog.jpg)',
     type: 'MarkdownRemark',
     contentDigest: '36579d03cdc3aae5e0e6ce2c4ba7e96c',
     owner: 'gatsby-transformer-remark' },
  frontmatter:
   { title: 'DevBlog',
     description:
      'Devblog is fullstack javascript web application.this is a multiuser blogging system.i created using node.js and mongodb.i also used Google Oauth
API and tinymce editor.',
     link: 'https://floating-everglades-10580.herokuapp.com/',
     github: 'https://github.com/yashrajb/DevBlog',
     download: '' },
  excerpt: '',
  rawMarkdownBody: '![DECENTROS](./devblog.jpg)',
  fileAbsolutePath:
我希望获得fileAbsolutePath值,这样我就可以生成slug,并可以使用onCreatePages节点api