{
  "id": "nextjs/image-optimization-internal-server-error",
  "signature": "Error: Image optimization failed for URL '...' with status 500. Internal error: sharp is not installed.",
  "signature_zh": "错误：对 URL '...' 的图像优化失败，状态码 500。内部错误：sharp 未安装。",
  "regex": "Image optimization failed.*Internal error: sharp is not installed",
  "domain": "nextjs",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Next.js image optimization relies on the 'sharp' library for server-side image processing. When sharp is missing or fails to install (e.g., on certain architectures or serverless environments), the optimization endpoint returns a 500 error.",
  "root_cause_type": "generic",
  "root_cause_zh": "Next.js 图像优化依赖 'sharp' 库进行服务器端图像处理。当 sharp 缺失或安装失败（例如在某些架构或无服务器环境中）时，优化端点返回 500 错误。",
  "versions": [
    {
      "version": "13.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "13.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "14.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "14.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "15.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Reinstalling sharp with npm install sharp without specifying the correct platform binary",
      "why_fails": "The default installation may try to build from source, failing on systems without C++ build tools. It's better to use --ignore-scripts or install platform-specific binaries.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting unoptimized: true on every Image component as a global workaround",
      "why_fails": "This disables all image optimization, leading to large unoptimized images, slower page loads, and potential layout shifts. It's a performance regression.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install sharp explicitly as a production dependency: npm install sharp@latest. Ensure your deployment platform supports sharp (e.g., Vercel, Netlify). For serverless, use next.config.js: experimental: { optimizePackageImports: ['sharp'] }.",
      "success_rate": 0.85,
      "how": "Install sharp explicitly as a production dependency: npm install sharp@latest. Ensure your deployment platform supports sharp (e.g., Vercel, Netlify). For serverless, use next.config.js: experimental: { optimizePackageImports: ['sharp'] }.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If sharp cannot be installed, set images.unoptimized: true in next.config.js to disable all image optimization globally, or use a third-party image CDN provider configured via images.loader.",
      "success_rate": 0.75,
      "how": "If sharp cannot be installed, set images.unoptimized: true in next.config.js to disable all image optimization globally, or use a third-party image CDN provider configured via images.loader.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Install sharp explicitly as a production dependency: npm install sharp@latest. Ensure your deployment platform supports sharp (e.g., Vercel, Netlify). For serverless, use next.config.js: experimental: { optimizePackageImports: ['sharp'] }.",
    "If sharp cannot be installed, set images.unoptimized: true in next.config.js to disable all image optimization globally, or use a third-party image CDN provider configured via images.loader."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/api-reference/components/image#optimization",
  "official_doc_section": null,
  "error_code": "500",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}