#Problems with Images (Server Error: MissingSharp: Could not find Sharp. Please install Sharp

11 messages · Page 1 of 1 (latest)

peak bough
#

I guys, i deploy my website on Vercel, and I get errors on images, i'm already set the image service but I still have the same error

export default defineConfig({
  integrations: [tailwind()],
  base: "/",
  output: "server",
  adapter: vercel({ imageService: true}),
  image: {
    domains: ["images.unsplash.com"],
  }
});

https://kamakia-landing-lwjcjtks5-greenappdev113s-projects.vercel.app/

surreal tundra
#

Are you using pnpm?

peak bough
surreal tundra
#

Hmm, usually it's only an issue with PNPM because it's a strict package manager

You can try just installing sharp manually tho

peak bough
# surreal tundra Hmm, usually it's only an issue with PNPM because it's a strict package manager ...

Okay I try npm install sharp and redeploy and still doesn't work, idk if a bad Image component usage

 <Image
  src={myHeroImage3}
  alt="Hero image"
  class="my-class"
  width="2350"
  height="2359"
  class="lg:absolute lg:w-full lg:h-full rounded-3xl object-cover lg:max-h-none max-h-96"
/>
"dependencies": {
    "@astrojs/check": "^0.4.1",
    "@astrojs/tailwind": "^5.1.0",
    "@astrojs/vercel": "^7.8.2",
    "astro": "^4.16.10",
    "lucide-astro": "^0.456.0",
    "sharp": "^0.33.5",
    "tailwindcss": "^3.4.1",
    "typescript": "^5.3.3"
  },
#

I get a more detailed error from Vercel

Could not process image request: MissingSharp: Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service. at loadSharp (file:///var/task/.vercel/output/_functions/chunks/astro/assets-service_BHAe3Dce.mjs:648:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.transform (file:///var/task/.vercel/output/_functions/chunks/astro/assets-service_BHAe3Dce.mjs:660:25) at async Module.GET (file:///var/task/.vercel/output/_functions/pages/_image.astro.mjs:66:30) at async renderEndpoint (file:///var/task/.vercel/output/_functions/chunks/astro/server_B818IF8O.mjs:49:18) at async lastNext (file:///var/task/.vercel/output/_functions/chunks/entrypoint_DobRapc1.mjs:1652:23) at async callMiddleware (file:///var/task/.vercel/output/_functions/chunks/entrypoint_DobRapc1.mjs:798:10) at async RenderContext.render (file:///var/task/.vercel/output/_functions/chunks/entrypoint_DobRapc1.mjs:1691:22) at async NodeApp.render (file:///var/task/.vercel/output/_functions/chunks/entrypoint_DobRapc1.mjs:2345:18) at async Server.handler (file:///var/task/.vercel/output/_functions/chunks/entrypoint_DobRapc1.mjs:2719:29) { loc: undefined, title: 'Could not find Sharp.', hint: "See Sharp's installation instructions for more information: https://sharp.pixelplumbing.com/install. If you are not relying on `astro:assets` to optimize, transform, or process any images, you can configure a passthrough image service instead of installing Sharp. See https://docs.astro.build/en/reference/errors/missing-sharp for more information.\n" + '\n' + 'See https://docs.astro.build/en/guides/images/#default-image-service for more information on how to migrate to another image service.', frame: undefined, type: 'AstroError' }

surreal tundra
#

Pretty weird

<@&1129102257422610512> any ideas? Using yarn not pnpm

unborn anchor
#

Hm since you’re using the Vercel image service I don’t know why sharp/ astros default image service would be involved at all

final thicket
#

Try deleting node_modules and then running yarn install

peak bough
#

Okay

#

I fixed it guys! I just remove node_modules and .vercel folder and it works!!! thanks to all