ENOENT: no such file or directory, open '.cache/graphql-schema.json' during build
0 reputation · 14 Jun 2025, 17:46 UTC
Production Build Failure After Data Recovery
A Gatsby project is being restored from a backup that contains source files and configuration but excludes the .cache directory. While the development server recreates missing cache artifacts automatically, the production build process fails when attempting to access the GraphQL schema.
The build fails with the following error string: Failed to compile: ENOENT: no such file or directory, open '.cache/graphql-schema.json'.
There is uncertainty regarding whether this state requires a manual gatsby clean to reset the internal state before a fresh build can succeed, or if the build process should natively handle the absence of the schema file by triggering a full re-index of the data layer.
- Does the production build process expect a pre-existing
.cachedirectory when deploying from a clean backup? - What is the recommended sequence to resolve this specific ENOENT error without risking stale plugin data?