Gatsby - 无法获取此 StaticQuery 的结果

Jam*_*all 5 contentful gatsby netlify

我有一个 Gatsby 网站,已经在线平稳运行了 3 个月。截至 7 月 24 日星期五,我开始收到以下结果,用户只能看到空白屏幕。

    
    This is likely a bug in Gatsby and if refreshing the page does not fix it, please open an issue in https://github.com/gatsbyjs/gatsby/issues
        at h (gatsby-browser-entry.js:77)
        at O9Ll.t.default (buybike.js:52)
        at Ki (react-dom.production.min.js:153)
        at Fa (react-dom.production.min.js:175)
        at vo (react-dom.production.min.js:263)
        at cu (react-dom.production.min.js:246)
        at ou (react-dom.production.min.js:246)
        at Zo (react-dom.production.min.js:239)
        at react-dom.production.min.js:123
        at scheduler.production.min.js:19 
Run Code Online (Sandbox Code Playgroud)

这是我的 package.json

    "@reach/dialog": "^0.10.1",
    "@reach/tabs": "^0.10.1",
    "@reach/visually-hidden": "^0.10.1",
    "@stripe/stripe-js": "^1.4.0",
    "bootstrap": "^4.4.1",
    "dotenv": "^8.2.0",
    "gatsby": "^2.23.18",
    "gatsby-background-image": "^1.1.1",
    "gatsby-image": "^2.3.1",
    "gatsby-plugin-create-client-paths": "^2.2.1",
    "gatsby-plugin-manifest": "^2.3.3",
    "gatsby-plugin-netlify-identity": "0.0.3",
    "gatsby-plugin-offline": "^3.1.2",
    "gatsby-plugin-prefetch-google-fonts": "^1.4.3",
    "gatsby-plugin-react-helmet": "^3.2.1",
    "gatsby-plugin-robots-txt": "^1.5.1",
    "gatsby-plugin-sharp": "^2.5.3",
    "gatsby-plugin-sitemap": "^2.4.3",
    "gatsby-plugin-transition-link": "^1.18.0",
    "gatsby-remark-responsive-iframe": "^2.3.3",
    "gatsby-source-contentful": "^2.2.7",
    "gatsby-source-filesystem": "^2.2.2",
    "gatsby-source-stripe": "^3.0.7",
    "gatsby-transformer-remark": "^2.7.3",
    "gatsby-transformer-sharp": "^2.4.3",
    "gsap": "^3.2.6",
    "netlify": "^4.1.5",
    "prop-types": "^15.7.2",
    "react": "^16.12.0",
    "react-bootstrap": "^1.0.0",
    "react-dom": "^16.12.0",
    "react-helmet": "^5.2.1",
    "react-icons": "^3.10.0",
    "react-netlify-identity-widget": "^0.2.7",
    "react-spring": "^8.0.27",
    "redux": "^4.0.5",
    "styled-components": "^5.1.0",
    "video-react": "^0.14.1"
  },
Run Code Online (Sandbox Code Playgroud)

我的网站托管在 Netlify 上,并使用 Contentful 作为我的 CMS。该网站可以在这里找到:https://revelwell.com.au/ - 初始页面会加载,但如果您单击任何链接离开该页面,则会发生错误。如果您点击刷新,页面加载效果会很好。

非常感谢任何帮助。谢谢詹姆斯

小智 5

    \n
  1. 只需将使用 useStaticQuery 挂钩的组件的文件名大写即可。

    \n

    示例: \xc2\xa0 header.js \xc2\xa0 -> \xc2\xa0 Header.js

    \n
  2. \n
  3. 然后清除 Gatsby 缓存并重新启动服务器。

    \n
  4. \n
  5. 这应该可以解决问题。

    \n
  6. \n
\n


小智 4

gatsby 项目刚刚进行了修复(github.com/gatsbyjs/gatsby/pull/26077/

现在版本2.24.13可用

如果你的 package.json 是:"gatsby": "^2.23.18"你只需要删除你的yarn.lock并执行 ayarn install来获取最新版本(你可以通过执行来检查你的 gatsby 版本yarn list gatsby

这应该可以解决你的问题(我的问题已经解决了!)。


归档时间:

查看次数:

10008 次

最近记录:

2 年,10 月 前