gatsby-plugin-s3 icon indicating copy to clipboard operation
gatsby-plugin-s3 copied to clipboard

no such file or directory, open - gatsby-plugin-s3/src/gatsby-node.ts

Open chilupa opened this issue 5 years ago • 8 comments

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_modules and re installed
  • Did gatsby build

chilupa avatar Oct 10 '20 17:10 chilupa

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?

YoshiWalsh avatar Oct 11 '20 00:10 YoshiWalsh

It doesn't seem to appear now. Weird! Will reopen this issue if see it again. Thank you for your follow up. 😄

chilupa avatar Oct 13 '20 22:10 chilupa

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

djamison avatar Oct 23 '20 05:10 djamison

Thanks @djamison , that's very useful. So we need to distribute both .ts and .map files, or neither.

YoshiWalsh avatar Oct 23 '20 05:10 YoshiWalsh

Have the same issue, can't find any issues in my onPostBuild :'(

marcus13371337 avatar Oct 29 '20 15:10 marcus13371337

I think I found the issue. I was creating ~20k redirects without having the flag generateRedirectObjectsForPermanentRedirects set to true, that fixed my issue

marcus13371337 avatar Oct 29 '20 15:10 marcus13371337

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.

YoshiWalsh avatar Oct 29 '20 21:10 YoshiWalsh

Hi , i had this issue before , and the reason is having more than 50 redirect url without adding this flag generateRedirectObjectsForPermanentRedirects

ahmadkhalaf1 avatar Nov 11 '20 12:11 ahmadkhalaf1