gatsby: [1.0] TypeError: Cannot read property 'component---src-pages-index-js' of undefined
Description
1 npm i -S gatsby -g 2 gatsby new gatsby-test 3 cd gatsby-test 4 gatsby develop
*im on a windows computer at work, and the location of the global installation (from what I can tell, im not THE most savvy, im a self-taught programmer) is in: C:\Users\[username]\AppData\Roaming\npm\node_modules
Steps to reproduce
same as description… this is just simply trying to run the gatsby develop script on the basic as-is ‘new’ gatsby project
Expected result
should run on localhost:8000
Actual result
Receive the following text @ localhost:8000
TypeError: Cannot read property ‘component—src-pages-index-js’ of undefined
fetchResource C:/Users/fnarbona/.atom/projects/gatsby-test/.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 C:/Users/fnarbona/.atom/projects/gatsby-test/.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 C:/Users/fnarbona/.atom/projects/gatsby-test/.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 C:/Users/fnarbona/.atom/projects/gatsby-test/.cache/component-renderer.js:27
24 | 25 | this.state = { 26 | location,
27 | pageResources: loader.getResourcesForPathname(location.pathname), 28 | } 29 | } 30 |
View compiled
▶ 43 stack frames were collapsed.
(anonymous function) C:/Users/fnarbona/.atom/projects/gatsby-test/.cache/app.js:42
39 | Root = Root.default 40 | } 41 |
42 | domReady(() => 43 | ReactDOM.render( 44 | <HotContainer> 45 | <Root />
View compiled
HTMLDocument.listener C:/Users/fnarbona/.atom/projects/gatsby-test/node_modules/domready/ready.js:23
Environment
PS C:\Users\fnarbona.atom\projects\gatsby-test> gatsby info --clipboard
System: OS: Windows 7 CPU: x64 Intel® Core™ i7-2600 CPU @ 3.40GHz Binaries: npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD npmPackages: gatsby: ^1.9.247 => 1.9.250 gatsby-link: ^1.6.40 => 1.6.40 gatsby-plugin-react-helmet: ^2.0.10 => 2.0.10
error The system cannot find the path specified.
Error: The system cannot find the path specified.
-
envinfo.js:1 Function.e.exports.sync [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:7778
-
envinfo.js:1 Object.copySync [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:104976
-
envinfo.js:1 Object.t.writeSync.e [as writeSync] [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:123499
-
envinfo.js:1 [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:124274
-
envinfo.js:1 Promise.all.then.e [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:124289
-
util.js:16 tryCatcher [npm]/[gatsby]/[bluebird]/js/release/util.js:16:23
-
promise.js:512 Promise._settlePromiseFromHandler [npm]/[gatsby]/[bluebird]/js/release/promise.js:512:31
-
promise.js:569 Promise._settlePromise [npm]/[gatsby]/[bluebird]/js/release/promise.js:569:18
-
promise.js:614 Promise._settlePromise0 [npm]/[gatsby]/[bluebird]/js/release/promise.js:614:10
-
promise.js:693 Promise._settlePromises [npm]/[gatsby]/[bluebird]/js/release/promise.js:693:18
-
promise.js:638 Promise._fulfill [npm]/[gatsby]/[bluebird]/js/release/promise.js:638:18
-
promise_array.js:126 PromiseArray._resolve [npm]/[gatsby]/[bluebird]/js/release/promise_array.js:126:19
-
promise_array.js:144 PromiseArray._promiseFulfilled [npm]/[gatsby]/[bluebird]/js/release/promise_array.js:144:14
-
promise.js:574 Promise._settlePromise [npm]/[gatsby]/[bluebird]/js/release/promise.js:574:26
-
promise.js:614 Promise._settlePromise0 [npm]/[gatsby]/[bluebird]/js/release/promise.js:614:10
-
promise.js:693 Promise._settlePromises [npm]/[gatsby]/[bluebird]/js/release/promise.js:693:18
error UNHANDLED REJECTION
Error: The system cannot find the path specified.
-
envinfo.js:1 Function.e.exports.sync [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:7778
-
envinfo.js:1 Object.copySync [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:104976
-
envinfo.js:1 Object.t.writeSync.e [as writeSync] [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:123499
-
envinfo.js:1 [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:124274
-
envinfo.js:1 Promise.all.then.e [npm]/[gatsby]/[envinfo]/dist/envinfo.js:1:124289
-
util.js:16 tryCatcher [npm]/[gatsby]/[bluebird]/js/release/util.js:16:23
-
promise.js:512 Promise._settlePromiseFromHandler [npm]/[gatsby]/[bluebird]/js/release/promise.js:512:31
-
promise.js:569 Promise._settlePromise [npm]/[gatsby]/[bluebird]/js/release/promise.js:569:18
-
promise.js:614 Promise._settlePromise0 [npm]/[gatsby]/[bluebird]/js/release/promise.js:614:10
-
promise.js:693 Promise._settlePromises [npm]/[gatsby]/[bluebird]/js/release/promise.js:693:18
-
promise.js:638 Promise._fulfill [npm]/[gatsby]/[bluebird]/js/release/promise.js:638:18
-
promise_array.js:126 PromiseArray._resolve [npm]/[gatsby]/[bluebird]/js/release/promise_array.js:126:19
-
promise_array.js:144 PromiseArray._promiseFulfilled [npm]/[gatsby]/[bluebird]/js/release/promise_array.js:144:14
-
promise.js:574 Promise._settlePromise [npm]/[gatsby]/[bluebird]/js/release/promise.js:574:26
-
promise.js:614 Promise._settlePromise0 [npm]/[gatsby]/[bluebird]/js/release/promise.js:614:10
-
promise.js:693 Promise._settlePromises [npm]/[gatsby]/[bluebird]/js/release/promise.js:693:18
File contents (if changed)
gatsby-config.js
: N/A
package.json
: N/A
gatsby-node.js
: N/A
gatsby-browser.js
: N/A
gatsby-ssr.js
: N/A
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (3 by maintainers)
For those who solved the problem by changing port: Clearing the browser cache (I’m using chrome) fixed the issue for me without changing port.
I second @jonny5 's answer. But rather than clearing the entire browser’s cache, you can just open developer tools and click “clear site data” from Applications tab.
For me the problem wasn’t the final build, but the error spun up during the Gatsby develop command. I worked around the issue by specifying a new port instead of port 8000 and it for some reason worked.
Clearing the site data worked.
Also just had this issue. Clearing site data worked for me!
I’ve tried removing .cache folder and rebuild but still doesn’t work. but This solution works for me. just clear site data. Thank you @prajapati-parth
For me the same problem was happening for a day. Then i went to the tab which showing error in chrome, opened setting-developer tools-application-storage. there was a button clear storage, clicked it, then reloaded the site localhost:8000 and boom its worked.