title: Is there any way of getting item from localstorage inside gatsby-node.js file?
body: <p>I want to get an item from <strong>localstorage</strong> inside <strong>gatsby-node.js</strong><br/>
  I tried like this :</p>
  
  <pre><code>exports.onCreateNode = async function({ node, actions }) {
    const { createNode, createNodeField } = actions
  
    // here i used for localstorage item
    console.log(window.localStorage.getItem("token"))
  
  
    createNodeField({
      node,
      name: `happiness`,
      value: `is sweet graphql queries`,
    })
  }
  </code></pre>
  
  <p>And got error like this :</p>
  
  <pre><code>"gatsby-node.js" threw an error while running the onCreateNode lifecycle:
  
  localStorage is not defined
  
    19 | exports.onCreateNode = async function({ node, actions }) {
    20 |   const { createNode, createNodeField } = actions
  &gt; 21 |   console.log(localStorage.getItem("token"))
       |               ^
    22 |   createNodeField({
    23 |     node,
    24 |     name: `happiness`,
  </code></pre>
  
  <p><strong>N.B.</strong> I have set data <strong>"token"</strong> in my localstorage</p>