我正在尝试使用gatsby-starter-gcn来创建一个网站。在这一点上,我只想能够在本地查看入门站点,以便我可以开始进行编辑。但是当我运行gatsby develop时,我得到了以下错误:
ERROR #10123 CONFIG
We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.
Error: Contentful space ID and access token need to be provided.
- gatsby-config.js:14 Object.<anonymous>
C:/Windows/system32/gatsby-starter-gcn/gatsby-config.js:14:11
- v8-compile-cache.js:178 Module._compile
[gatsby-starter-gcn]/[v8-compile-cache]/v8-compile-cache.js:178:30
- loader.js:1220 Object.Module._extensions..js
internal/modules/cjs/loader.js:1220:10
- loader.js:1049 Module.load
internal/modules/cjs/loader.js:1049:32
- loader.js:937 Function.Module._load
internal/modules/cjs/loader.js:937:14
- loader.js:1089 Module.require
internal/modules/cjs/loader.js:1089:19
- v8-compile-cache.js:159 require
[gatsby-starter-gcn]/[v8-compile-cache]/v8-compile-cache.js:159:20
- get-config-file.js:33 getConfigFile
[gatsby-starter-gcn]/[gatsby]/dist/bootstrap/get-config-file.js:33:20
- index.js:134 module.exports
[gatsby-starter-gcn]/[gatsby]/dist/bootstrap/index.js:134:46
- develop-process.js:433 module.exports
[gatsby-starter-gcn]/[gatsby]/dist/commands/develop-process.js:433:36
- task_queues.js:97 processTicksAndRejections
internal/process/task_queues.js:97:5
not finished open and validate gatsby-configs - 0.052s我尝试打开gatsby-config.js文件以查看问题。我可以在记事本中打开它,但是Windows Script Host返回了这个错误:行:1字符:5错误:预期的';‘代码: 800A03EC来源:微软JScript编译错误
我想如果我能修复这个文件中的编译错误,我的问题可能会被修复,但我还不能确定如何修复,因为我对javascript没有太多的经验。这是指向GitHub上文件的链接:https://github.com/ryanwiemer/gatsby-starter-gcn/blob/master/gatsby-config.js
发布于 2020-06-04 22:34:52
看起来好像抛出了这个错误,因为您的存储库中可能没有.env文件,也没有使用内容丰富的SPACE_ID ACCESS_TOKEN设置windows环境变量。
https://github.com/ryanwiemer/gatsby-starter-gcn/blob/master/gatsby-config.js#L7
创建这些变量应该会为您创建此建筑。
发布于 2020-06-04 22:46:19
我相信您需要一个在项目根目录下包含SPACE_ID和ACCESS_TOKEN的.env文件。
发布于 2020-06-04 23:51:27
该项目需要在项目的根目录中创建.contentful.json配置文件。您可以运行npm run setup或yarn setup,让它为您提供内容丰富的API key信息,指导您完成创建过程。在此之后,运行gatsby develop应该可以很好地工作。
https://stackoverflow.com/questions/62196602
复制相似问题