{"record":{"id":"eb6483a6a545b323","repo":"gatsbyjs/gatsby","slug":"please-install-gatsby-plugin-sharp","errorCode":null,"errorMessage":"Please install gatsby-plugin-sharp","messagePattern":"Please install gatsby-plugin-sharp","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-image/src/node-apis/image-processing.ts","lineNumber":200,"sourceCode":"    }\n  )\n\n  return Promise.all(promises).then(() => {})\n}\n\nexport async function writeImage(\n  file: FileSystemNode,\n  args: ISharpGatsbyImageArgs,\n  pathPrefix: string,\n  reporter: Reporter,\n  cache: GatsbyCache,\n  filename: string\n): Promise<void> {\n  let generateImageData\n  try {\n    generateImageData = require(`gatsby-plugin-sharp`).generateImageData\n  } catch (e) {\n    reporter.panic(`Please install gatsby-plugin-sharp`)\n  }\n  try {\n    const options = { file, args, pathPrefix, reporter, cache }\n\n    if (!generateImageData) {\n      reporter.warn(`Please upgrade gatsby-plugin-sharp`)\n      return\n    }\n    // get standard set of fields from sharp\n    const sharpData = await generateImageData(options)\n\n    if (sharpData) {\n      // Write the image properties to the cache\n      await fs.writeJSON(filename, sharpData)\n    } else {\n      reporter.warn(`Could not process image ${file.relativePath}`)\n    }\n  } catch (e) {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-image/src/node-apis/image-processing.ts#L182-L218","documentation":"In writeImage (image-processing.ts:197-201), the plugin dynamically requires 'gatsby-plugin-sharp' to access generateImageData, which computes responsive image dimensions, formats, and srcset entries. If the require fails (module not found), reporter.panic fires. gatsby-plugin-sharp is the actual image transformation engine that gatsby-plugin-image depends on at build time.","triggerScenarios":"Using gatsby-plugin-image (<StaticImage> or <GatsbyImage>) without gatsby-plugin-sharp installed. The require('gatsby-plugin-sharp') throws MODULE_NOT_FOUND.","commonSituations":"Fresh project that added gatsby-plugin-image but not gatsby-plugin-sharp. Upgrading Gatsby versions where gatsby-plugin-sharp was split out as a separate dependency. Monorepo resolution issues.","solutions":["Install gatsby-plugin-sharp: npm install gatsby-plugin-sharp gatsby-transformer-sharp","Add both to gatsby-config.js plugins array","Verify version compatibility with your gatsby-plugin-image version"],"exampleFix":"// before: only gatsby-plugin-image installed\n// after: package.json + gatsby-config.js\ndependencies: {\n  \"gatsby-plugin-image\": \"^2.0.0\",\n  \"gatsby-plugin-sharp\": \"^4.0.0\",\n  \"gatsby-transformer-sharp\": \"^4.0.0\",\n}\n\n// gatsby-config.js\nplugins: [\n  `gatsby-plugin-image`,\n  `gatsby-transformer-sharp`,\n  `gatsby-plugin-sharp`,\n]","handlingStrategy":"validation","validationCode":"// Pre-build check for gatsby-plugin-sharp\ntry {\n  require.resolve('gatsby-plugin-sharp')\n  const { generateImageData } = require('gatsby-plugin-sharp')\n  if (typeof generateImageData !== 'function') {\n    console.error('gatsby-plugin-sharp is installed but generateImageData is missing — upgrade required')\n  }\n} catch {\n  console.error('gatsby-plugin-sharp is required by gatsby-plugin-image')\n  process.exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always install gatsby-plugin-sharp and gatsby-transformer-sharp with gatsby-plugin-image","Keep all Gatsby image packages at compatible major versions","After upgrades, verify generateImageData export exists before building"],"tags":["missing-dependency","gatsby-plugin","image-processing","sharp"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}