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