Failed on deploying gatsby site to Netlify

Today I was trying to deploy my website to Netlify but getting an error on the cache file. I don’t know where is the problem, as it’s working nice on the local machine.
Here is the deploy log:

12:35:16 AM: error There was a problem reading the file: /opt/build/repo/.cache/dev-404-page.js
12:35:16 AM:
12:35:16 AM:
12:35:16 AM: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/.cache/dev-404 -page.js’
12:35:16 AM:
12:35:16 AM: error There was a problem reading the file: /opt/build/repo/src/pages/404.js
12:35:16 AM:
12:35:16 AM:
12:35:16 AM: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/src/pages/404. js’
12:35:16 AM:
12:35:16 AM: failed extract queries from components - 0.142s
12:35:16 AM: error Failed to write out requires ENOENT: no such file or directory, open ‘/opt/build/repo/.cache/sync-requires.js.1603305316626’
12:35:16 AM:
12:35:16 AM:
12:35:16 AM: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/.cache/sync-re quires.js.1603305316626’
12:35:16 AM:
12:35:16 AM: not finished write out requires - 0.018s
12:35:16 AM: ​
12:35:16 AM: ┌─────────────────────────────┐
12:35:16 AM: │ “build.command” failed │
12:35:16 AM: └─────────────────────────────┘
12:35:16 AM: ​
12:35:16 AM: Error message
12:35:16 AM: Command failed with exit code 1: gatsby develop
12:35:16 AM: ​
12:35:16 AM: Error location
12:35:16 AM: In Build command from Netlify app:
12:35:16 AM: gatsby develop
12:35:16 AM: ​
12:35:16 AM: Resolved config
12:35:16 AM: build:
12:35:16 AM: command: gatsby develop
12:35:16 AM: commandOrigin: ui
12:35:16 AM: publish: /opt/build/repo/public
12:35:17 AM: Execution timed out after 29m54.491933387s
12:35:17 AM: Error running command: Command did not finish within the time limit
12:35:17 AM: Failing build: Failed to build site
12:35:17 AM: Failed during stage ‘building site’: Command did not finish within the time limit
12:35:17 AM: Finished processing build request in 29m58.534616434s

The problem is nice and clear. You’re running gatsby develop instead of gatsby build on Netlify.

But i have solve the issue by removing Package-lock.Json and then deploy worked.

gatsby develop is not meant to be used for a production build. It says so in the console too. It’s not optimised and won’t even work for SEO. Rest, your call.

I have set on deploy command Gatsby Build. Gatsby develop is for local machine. I don’t know what you are talking about.

hey @muntasiraonik - @hrishikesh is right. You are definitely running gatsby develop when you are deploying your site, and that isn’t the right command for a production deploy most likely.

Issue fixed. However, in the deploy command inside Netlify, i set Netlify Build. But i don’t know why it showed me like this. I have deployed my website and its working nice.

1 Like

great, well, that’s the most important thing :muscle: