简体   繁体   English

当在 github 上创建 repo 时,Gatsby 开发服务器停止工作。 理智,盖茨比错误

[英]Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error

I received a github repo backup from somebody elses account.我从其他人的帐户收到了 github 回购备份。 The project is running gatsby, sanity cms and is hosted via netlify.该项目正在运行 gatsby、sanity cms,并通过 netlify 托管。 When I extract the archive and saving the folder locally, I am perfectly able to get the gatsby development server runnning just by doing "yarn install" and "yarn gatsby develop".当我提取存档并在本地保存文件夹时,我完全可以通过执行“yarn install”和“yarn gatsby develop”来运行 gatsby 开发服务器。

However, when I create a new repo and import the project to my github account, the development server is not running anymore.但是,当我创建一个新的 repo 并将项目导入我的 github 帐户时,开发服务器不再运行。 We tried it on several machines and we always get the same error in terminal trying "yarn gatsby develop".我们在几台机器上尝试过,在终端尝试“yarn gatsby develop”时总是遇到同样的错误。

 success open and validate gatsby-configs - 0.131s success load plugins - 2.486s success onPreInit - 0.038s success initialize cache - 0.009s success copy gatsby files - 0.091s info [sanity] Fetching remote GraphQL schema ERROR #gatsby-source-sanity_drafts.10003 [sanity] The token specified is not valid or has been deleted

How is that possible?这怎么可能? I tried to fix this for days but I don't get it.我试图解决这个问题好几天,但我不明白。 The only differnce between being able to run the dev server and this error is to save the code to github... Is it maybe some sort of routing problem in the gatsby-config.js?能够运行开发服务器和此错误之间的唯一区别是将代码保存到 github ... 可能是 gatsby-config.js 中的某种路由问题?

Would appreciate your help a lot!非常感谢您的帮助!

It seems that you are missing the environment variables in your new projects so your Sanity configuration is not valid, hence Gatsby is not able to fetch the data from the sources.您似乎缺少新项目中的环境变量,因此您的 Sanity 配置无效,因此 Gatsby 无法从源中获取数据。

There should be a .env.development or .env.production files in your original code placed in the root of the project.在项目根目录下的原始代码中应该有一个.env.development.env.production文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gatsby 在 GitHub Actions CI 中运行时抛出 SIGSEV 错误 - Gatsby throws SIGSEV error when running in GitHub Actions CI 运行gatsby development时发现预设的“反应”,从而导致gats错误 - error with gatsby finding preset “react” when running gatsby develop 在 Zeit 上使用 gatsby-source-buttercms 部署 gatsby 应用程序时出错 - Error when deploying the gatsby app with gatsby-source-buttercms on Zeit 为什么在运行 Gatsby 开发服务器时会遇到这些错误? - Why do I run into these errors when running my Gatsby development server? 盖茨比没有注意新发布的更改的理智 - Gatsby not watching sanity for new published changes 错误 #98123 WEBPACK 生成开发 JavaScript 包在 `gatsby develop` 上失败 - ERROR #98123 WEBPACK Generating development JavaScript bundle failed on `gatsby develop` Gatsby在开发过程中工作正常,但在构建过程中引发错误 - Gatsby works fine during development but throws error during build 在 Gatsby 中出现错误:TypeError:无法读取未定义的属性“github” - Getting error in Gatsby: TypeError: Cannot read property 'github' of undefined Gatsby activeClassName 无法预览 - Gatsby activeClassName not working preview 在GitHub页面上设置Gatsby - Setting up Gatsby on GitHub Pages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM