盖茨比 - 无法读取未定义的 属性 'component---src-pages-index-jsx'
Gatsby - Cannot read property 'component---src-pages-index-jsx' of undefined
我正在尝试将我现有的带有 WordPress 后端的 ReactJS 应用程序迁移到 GatsbyJS。我是 GatsbyJS 的新手,并按照他们页面上的说明在 Windows 10 机器上进行设置。设置 运行 非常好,我可以开始我的迁移过程,但过了一段时间后,我在尝试加载页面时只收到以下错误:
TypeError: Cannot read property 'component---src-pages-index-jsx' of undefined
fetchResource
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:77
74 | // Find resource
75 | let resourceFunction
76 | if (resourceName.slice(0, 12) === `component---`) {
> 77 | resourceFunction = asyncRequires.components[resourceName]
78 | } else if (resourceName.slice(0, 9) === `layout---`) {
79 | resourceFunction = asyncRequires.layouts[resourceName]
80 | } else {
View compiled
getResourceModule
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:112
109 | cb(failedResources[resourceName])
110 | })
111 | } else {
> 112 | fetchResource(resourceName, (err, executeChunk) => {
113 | if (err) {
114 | cb(err)
115 | } else {
View compiled
getResourcesForPathname
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:358
355 | })
356 | }
357 | }
> 358 | getResourceModule(page.componentChunkName, (err, c) => {
359 | if (err) {
360 | handleResourceLoadError(
361 | page.path,
View compiled
new ComponentRenderer
D:/GitHub/gatsby-starter-wordpress/.cache/component-renderer.js:26
23 |
24 | this.state = {
25 | location,
> 26 | pageResources: loader.getResourcesForPathname(location.pathname),
27 | }
28 | }
29 |
View compiled
▶ 43 stack frames were collapsed.
(anonymous function)
D:/GitHub/gatsby-starter-wordpress/.cache/app.js:42
39 | Root = Root.default
40 | }
41 |
> 42 | domReady(() =>
43 | ReactDOM.render(
44 | <HotContainer>
45 | <Root />
View compiled
HTMLDocument.listener
D:/GitHub/gatsby-starter-wordpress/node_modules/domready/ready.js:23
我尝试删除任何自定义编写的组件,直到我得到正常的启动样板。但它仍然行不通。所以我继续甚至创建了一个新项目来测试 gatsby-cli
是否仍然有效。但是卸载并重新安装软件包仍然没有解决我的问题。任何帮助或提示将不胜感激。
我遇到了同样的问题。我已通过 清理浏览器缓存 修复它。
在清理 chrome 的缓存之前,我已经完成了 gatsby clean
,但我认为这无关紧要。
我正在尝试将我现有的带有 WordPress 后端的 ReactJS 应用程序迁移到 GatsbyJS。我是 GatsbyJS 的新手,并按照他们页面上的说明在 Windows 10 机器上进行设置。设置 运行 非常好,我可以开始我的迁移过程,但过了一段时间后,我在尝试加载页面时只收到以下错误:
TypeError: Cannot read property 'component---src-pages-index-jsx' of undefined
fetchResource
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:77
74 | // Find resource
75 | let resourceFunction
76 | if (resourceName.slice(0, 12) === `component---`) {
> 77 | resourceFunction = asyncRequires.components[resourceName]
78 | } else if (resourceName.slice(0, 9) === `layout---`) {
79 | resourceFunction = asyncRequires.layouts[resourceName]
80 | } else {
View compiled
getResourceModule
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:112
109 | cb(failedResources[resourceName])
110 | })
111 | } else {
> 112 | fetchResource(resourceName, (err, executeChunk) => {
113 | if (err) {
114 | cb(err)
115 | } else {
View compiled
getResourcesForPathname
D:/GitHub/gatsby-starter-wordpress/.cache/loader.js:358
355 | })
356 | }
357 | }
> 358 | getResourceModule(page.componentChunkName, (err, c) => {
359 | if (err) {
360 | handleResourceLoadError(
361 | page.path,
View compiled
new ComponentRenderer
D:/GitHub/gatsby-starter-wordpress/.cache/component-renderer.js:26
23 |
24 | this.state = {
25 | location,
> 26 | pageResources: loader.getResourcesForPathname(location.pathname),
27 | }
28 | }
29 |
View compiled
▶ 43 stack frames were collapsed.
(anonymous function)
D:/GitHub/gatsby-starter-wordpress/.cache/app.js:42
39 | Root = Root.default
40 | }
41 |
> 42 | domReady(() =>
43 | ReactDOM.render(
44 | <HotContainer>
45 | <Root />
View compiled
HTMLDocument.listener
D:/GitHub/gatsby-starter-wordpress/node_modules/domready/ready.js:23
我尝试删除任何自定义编写的组件,直到我得到正常的启动样板。但它仍然行不通。所以我继续甚至创建了一个新项目来测试 gatsby-cli
是否仍然有效。但是卸载并重新安装软件包仍然没有解决我的问题。任何帮助或提示将不胜感激。
我遇到了同样的问题。我已通过 清理浏览器缓存 修复它。
在清理 chrome 的缓存之前,我已经完成了 gatsby clean
,但我认为这无关紧要。