gatsby-plugin-s3
gatsby-plugin-s3 copied to clipboard
no such file or directory, open - gatsby-plugin-s3/src/gatsby-node.ts
When I'm running gatsby build, this is what I see on the console
ERROR
UNHANDLED REJECTION ENOENT: no such file or directory, open '/node_modules/gatsby-plugin-s3/src/gatsby-node.ts'
I tried these steps but none of them seem to work
- Did
gatsby clean - Removed
node_modulesand re installed - Did
gatsby build
Interesting, this is the second report of this error. (See also #197)
I haven't been able to reproduce this. Are you encountering this issue on a site with a public repository that I can see? Or would you be able to make an MCVE/reprex of the issue?
Failing that, what does your gatsby-config look like?
It doesn't seem to appear now. Weird! Will reopen this issue if see it again. Thank you for your follow up. 😄
I had the same error about the missing file. I had an error in my config, which broke the post build step. Seemed like gatsby-node.ts was needed for the stack trace and the JS map file provided the reference back to the TS, which isn't there. When I manually placed the file at src/gatsyby-node.ts, I saw the underlying error.
In my case, it was:
Error: Please either provide both 'hostname' and 'protocol', or neither of them.
- gatsby-node.ts:102 Object.exports.onPostBuild
[blog]/[gatsby-plugin-s3]/src/gatsby-node.ts:102:15
If you remove the .map files from the package, the error appears as expected (note the reference to the JS file instead):
Error: Please either provide both 'hostname' and 'protocol', or neither of them.
- gatsby-node.js:76 Object.exports.onPostBuild
[blog]/[gatsby-plugin-s3]/gatsby-node.js:76:15
Thanks @djamison , that's very useful. So we need to distribute both .ts and .map files, or neither.
Have the same issue, can't find any issues in my onPostBuild :'(
I think I found the issue. I was creating ~20k redirects without having the flag generateRedirectObjectsForPermanentRedirects set to true, that fixed my issue
For anyone who finds this issue via Google. This unhelpful error message hides what the real error is. As mentioned by djamison above, you can discover the real error by deleting node_modules/gatsby-plugin-s3/*.map.
When we have time we'll fix this properly, but for now please try this workaround.
Hi , i had this issue before , and the reason is having more than 50 redirect url without adding this flag generateRedirectObjectsForPermanentRedirects