childImageSharp {
fixed(width: 320, height: 320, cropFocus: ENTROPY) {
...GatsbyImageSharpFixed
}
fluid(maxWidth: 800, quality: 90) {
...GatsbyImageSharpFluid
presentationWidth
}
}
1:23:36 AM: error There was an error in your GraphQL query:
1:23:36 AM: Unexpected error value: "failed to process https://images.prismic.io/{MYURL}/9164c1cd-2aed-4955-bbf5-23ea20861ac4_565.jpg?auto=compress,formatnError: ENOENT: no such file or directory, open '/opt/build/repo/.cache/caches/gatsby-source-prismic-graphql/tmp-ced6c46e221e339dcd73ea911900fbca.jpg'"
插件似乎首先需要从prismic下载图像,但查询在下载图像之前运行,并且在运行生产构建时抛出上面的错误。知道怎么解决这个问题吗?
我相信您可以通过在gatsby-node.js
:的顶部添加以下代码来解决此问题
var fs = require("fs")
var dir = "./.cache/caches/gatsby-source-prismic-graphql"
exports.onPreBootstrap = () => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir)
}
}
来源--https://github.com/birkir/gatsby-source-prismic-graphql/issues/162#issuecomment-600641723
我想我通过降级到"gatsby-source-prismic-graphql": "3.3.1"
这随后引发了gatsby-browser.js
错误,但生成了图像
然后升级到
"gatsby-source-prismic-graphql": "3.4.1-alpha.0"
这清除了以前的gatsby-browser.js
错误,所以现在它运行得很好