Gatsby生产环境构建失败:Cannot find images job cache 错误求助
解决Gatsby生产构建"Cannot find images job cache"错误
问题详情
推送了一次master分支部署,仅安装了一个Gatsby sitemap插件,本地和测试环境运行正常,但生产环境构建时出现错误。回滚提交、移除插件相关代码后,构建仍报相同错误:
ERROR There was an unhandled error and we could not retrieve more information. Please run the command with the --verbose flag again.
Error: Cannot find images job cache
- prepare-build-changeset.ts:237 prepareBuildChangeSet
[lib]/[@gatsby-cloud-pkg]/gatsby-inc-build-cli/lib/utils/prepare-build-changeset.ts:237:13- incremental-builds.js:1407 Watching.handler
[lib]/[@gatsby-cloud-pkg]/gatsby-inc-build-cli/lib/incremental-builds.js:1407:30
可行修复方案
- 强制全量构建:关闭增量构建模式,让构建从头生成所有缓存。可在构建配置中添加环境变量
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=false,或直接使用命令gatsby build --no-incremental触发构建。 - 清空远程构建缓存:若使用Gatsby Cloud等平台,找到缓存管理入口,手动清除所有构建缓存后重新触发构建。
- 检查构建环境缓存状态:确认生产环境的缓存目录未被删除、权限正常,且缓存路径未因环境变量变更而异常。
- 重新同步依赖:本地删除
node_modules和锁文件(package-lock.json或yarn.lock),重新安装依赖后再推送,确保生产环境依赖与本地一致。
内容的提问来源于stack exchange,提问作者Harry Robinson
相关产品推荐
相关产品推荐

