Building a blog / portfolio with GatsbyJS and I'm struggling with this issue. I had the website working for the most part but all of a sudden it's stopped working. Really not sure why. The error doesn't make much sense to me. Hoping someone cold help me work out why.
https://github.com/ChildishhAlbino/childishhalbino.github.io/tree/problem-fixing
Above is a git repo with the project as I last left it.
An error screen should appear with the above error.
There will be warnings. There are some imports that aren't being used but aside from that everything should be fine.
Run npx gatsby info --clipboard
in your project directory and paste the output here.
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
Binaries:
npm: 6.4.1 - D:\Software Development\Languages, Frameworks,
etcnodeJs\npm.CMD
Languages:
Python: 3.7.0 - C:\Users\connoAppData\Local\Programs\Python\Python37-32\python.EXE
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.0.118 => 2.0.118
gatsby-image: ^2.0.19 => 2.0.29
gatsby-plugin-buildtime-timezone: ^1.0.3 => 1.0.3
gatsby-plugin-manifest: ^2.0.7 => 2.0.17
gatsby-plugin-offline: ^2.0.23 => 2.0.23
gatsby-plugin-react-helmet: ^3.0.1 => 3.0.6
gatsby-plugin-sass: ^2.0.2 => 2.0.10
gatsby-plugin-sharp: ^2.0.11 => 2.0.20
gatsby-source-filesystem: ^2.0.6 => 2.0.20
gatsby-transformer-remark: ^2.2.4 => 2.2.4
gatsby-transformer-sharp: ^2.1.7 => 2.1.13
error The system cannot find the path specified.
Error: The system cannot find the path specified.
envinfo.js:1 Object.copySync
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:6694 8
envinfo.js:1 Object.t.writeSync.e [as writeSync]
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4877 7
envinfo.js:1
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4693 4
envinfo.js:1 Promise.all.then.e
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4694 9
util.js:16 tryCatcher
[childishhalbino.github.io]/[bluebird]/js/release/util.js:16 :23
promise.js:512 Promise._settlePromiseFromHandler
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :512:31
promise.js:569 Promise._settlePromise
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :569:18
promise.js:614 Promise._settlePromise0
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10
promise.js:694 Promise._settlePromises
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18
promise.js:638 Promise._fulfill
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :638:18
promise_array.js:126 PromiseArray._resolve
[childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:126:19
promise_array.js:144 PromiseArray._promiseFulfilled
[childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:144:14
promise.js:574 Promise._settlePromise
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :574:26
promise.js:614 Promise._settlePromise0
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10
promise.js:694 Promise._settlePromises
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18
error UNHANDLED REJECTION
Error: The system cannot find the path specified.
envinfo.js:1 Object.copySync
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:6694 8
envinfo.js:1 Object.t.writeSync.e [as writeSync]
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4877 7
envinfo.js:1
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4693 4
envinfo.js:1 Promise.all.then.e
[childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4694 9
util.js:16 tryCatcher
[childishhalbino.github.io]/[bluebird]/js/release/util.js:16 :23
promise.js:512 Promise._settlePromiseFromHandler
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :512:31
promise.js:569 Promise._settlePromise
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :569:18
promise.js:614 Promise._settlePromise0
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10
promise.js:694 Promise._settlePromises
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18
promise.js:638 Promise._fulfill
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :638:18
promise_array.js:126 PromiseArray._resolve
[childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:126:19
promise_array.js:144 PromiseArray._promiseFulfilled
[childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:144:14
promise.js:574 Promise._settlePromise
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :574:26
promise.js:614 Promise._settlePromise0
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10
promise.js:694 Promise._settlePromises
[childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18
This is defenitely a bug in gatsby.
For now you can workaround this by changing line in https://github.com/ChildishhAlbino/childishhalbino.github.io/blob/problem-fixing/gatsby-node.js#L34
to:
component: path.resolve(`./src/components/Blog/BlogPostTemplate/blogPostTemplate.js`),
(I adjusted file/directory names casing to match one that exists in repository). It will get you pass that graphql error, but there will be some additional fixes needed elsewhere too because I hit:
error Building static HTML failed for path "/GatsbyJS and Web development/"
See our docs page on debugging HTML builds for help https://gatsby.app/debug-html
11 | <div className="blurb">
12 | <Image fluid={data.image.childImageSharp.fluid} />
> 13 | <Markdown source={data.blurb.childMarkdownRemark.rawMarkdownBody} />
| ^
14 | </div>
15 | )}
16 | />
WebpackError: TypeError: Cannot read property 'rawMarkdownBody' of null
But this is not really related to issue itself.
I will start working on fix to handle casing differences and to not throw this confusing error message.
Thanks for working that out for me! I actually didn't think it was a bug in Gatsby but whaddya know? ]
Quickly worked out those errors and the sites working again!
Thanks heaps :D
Have a nice day, good luck fixing the bug!
i think I'm having a similar issue, any update on a fix for this?
@imshuffling hopefully I'll open PR today. Just to confirm if your issue have similar root problem - are you on Mac? Because it seems that on Linux and Windows when you use wrong casing for component
argument in createPage
we will throw error saying that file can't be found.
@pieh Yeah I'm on a mac, i've logged a issue here - it may be related https://github.com/gatsbyjs/gatsby/issues/11732
Oh, this seems different. Error from this is:
Error: RelayParser: Encountered duplicate defintitions for one or more documents
I'm encountering the same bug as well when I create a new gatsby project using this starter and run gatsby develop
.
My error message:
GraphQL Error There was an error while compiling your site's GraphQL queries.
Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- usersAlexanderhoerlSitesBiobalanceSrcTemplatesProductPageIndexJs721922104
I'm also on mac.
```
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.7.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 72.0.3626.109
Safari: 12.0.3
npmPackages:
gatsby: ^2.0.111 => 2.0.111
gatsby-image: ^2.0.20 => 2.0.25
gatsby-plugin-google-analytics: ^2.0.13 => 2.0.13
gatsby-plugin-layout: ^1.0.11 => 1.0.11
gatsby-plugin-manifest: ^2.0.9 => 2.0.12
gatsby-plugin-offline: ^2.0.16 => 2.0.20
gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6
gatsby-plugin-sharp: ^2.0.14 => 2.0.16
gatsby-source-filesystem: ^2.0.8 => 2.0.12
gatsby-source-shopify2: ^2.0.7 => 2.0.7
gatsby-transformer-sharp: ^2.1.8 => 2.1.9
```
@AlexanderProd From quick look it seems like same issue. This is because
file path casing in https://github.com/AlexanderProd/gatsby-shopify-starter/blob/cff5d01029e514cf9ac8ac70987d01cd03a16f82/gatsby-node.js#L19
doesn't match casing exactly:
in gatsby-node: component: path.resolve(`./src/templates/ProductPage/index.js`),
in filesystem: src/templates/productPage/index.js
^ one `p` is uppercase other is lower case
so as a workaround, adjusting path in gatsby-node
should fix this.
@AlexanderProd From quick look it seems like same issue. This is because
file path casing in https://github.com/AlexanderProd/gatsby-shopify-starter/blob/cff5d01029e514cf9ac8ac70987d01cd03a16f82/gatsby-node.js#L19
doesn't match casing exactly:in gatsby-node: component: path.resolve(`./src/templates/ProductPage/index.js`), in filesystem: src/templates/productPage/index.js ^ one `p` is uppercase other is lower case
so as a workaround, adjusting path in
gatsby-node
should fix this.
I've noticed when I change it to a small p
building and developing works on Ubuntu machines but not on macOS, what makes it pretty difficult to develop on a mac and build on a linux server.
i have same problem
I met the same error.
The problem is because I was using Hyper terminal in windows.
Solution is using the default terminal in windows.
I met the same error.
The problem is because I was using Hyper terminal in windows.
Solution is using the default terminal in windows.
This solved it for me. Thanks. I did not have this issue on mac.
Additional info if anyone else stumble on this issue on Windows:
The gatsby npm run script is case-sensitive not only with the src file names, but including the entire path name:
I store all my projects in a folder in D: named Dev, (D:\Dev)
The "duplicate definitions" error is picking on the entire path (im running in WSL Vscode):
filesystem: /d/Dev/longreponame/gatsby-project/component-name-something
is apparently different from what it is generating:
page: /d/dev/longreponame/gatsby-project/component-name-something
I had to rename the Dev folder to lowercase just to fix it.
Gatsby should really add a warning to any Windows users about having capital letters in their dir names. This must stump quite a few users.
I met the same error.
The problem is because I was using Hyper terminal in windows.
Solution is using the default terminal in windows.
works for me too, thank you!
This error can be quite vague for starters but it is actually a warning due to the case sensitive nature of gatsby run scripts. For example: avoid this Myblog
in you file path. You can use myblog
or even myBlog
Gatsby should really add a warning to any Windows users about having capital letters in their dir names. This must stump quite a few users.
Thanks @patrick-wc ! It did stump me!
On Windows 10 using git bash, i was getting these errors/warnings because I had typed
cd /c/dev/git/projectname
code .
I quit code, and did
cd /C/Dev/Git/projectname
code .
And it all just worked...
This started happening to me, seemingly out of nowhere. Exiting out of the command line and reentering seemed to do the trick
This is still happening using Git Bash in VSCode terminal on Windows.
Git Bash by itself works fine.
On Windows 10 using git bash, i was getting these errors/warnings because I had typed
cd /c/dev/git/projectname
code .I quit code, and did
cd /C/Dev/Git/projectname
code .And it all just worked...
Fixed it for me as well. Used Windows PowerShell and worked when I typed cd FolderName
with correct casing.
wow i just randomly started having the same error. played around with different content folders for like half an hour before I realized that definitely wasn't it. after renaming my project folder it's working 100% now instantly.
I have found that explicitly typing out cd ~/path/to/project
avoids this issue (Using Gitbash in VSCode).
This is still occurring when I run gatsby develop
within a PowerShell prompt on Windows, but not when using the Command Prompt
For me the error was introduced when I duplicated a src/template/template.js
. I moved the file to src/fonts/
folder to eliminate this variant, but gatsby found it even there. Moving the file out of src folder resolved the issue. I think it has to do with a GraphQL queries being similar in different templates.
I had this same issue with when I was having the below code in 2 pages
export const query = graphql`
query contentFulAddBlogPost($slug: String, $locale: String) {
contentfulAddBlogPost(path: { eq: $slug }, node_locale: { eq: $locale }) {
path
node_locale
}
}
`;
to avoid this I changed contentFulAddBlogPost to allContentFulAddBlogPost in one of the components as below
export const query = graphql`
query allContentFulAddBlogPost($slug: String, $locale: String) {
contentfulAddBlogPost(path: { eq: $slug }, node_locale: { eq: $locale }) {
path
node_locale
}
}
`;
worked like a charm. hope it helps you guys in the future :)
Most helpful comment
Additional info if anyone else stumble on this issue on Windows:
The gatsby npm run script is case-sensitive not only with the src file names, but including the entire path name:
I store all my projects in a folder in D: named Dev, (D:\Dev)
The "duplicate definitions" error is picking on the entire path (im running in WSL Vscode):
filesystem: /d/Dev/longreponame/gatsby-project/component-name-something
is apparently different from what it is generating:
page: /d/dev/longreponame/gatsby-project/component-name-something
I had to rename the Dev folder to lowercase just to fix it.