Failed Astro build/deploy: `Could not find Sharp` even though sharp is installed

Site name:

Failing build: Netlify App
package.json: at 953310713d49289e3f887bbcedf71b5736fc7c41 · aqandrew/ · GitHub

I’m using pnpm.

The deploy logs sharp being installed during initialization:

12:25:43 PM: .../sharp@0.32.6/node_modules/sharp install$ (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
12:25:47 PM: .../sharp@0.32.6/node_modules/sharp install: sharp: Downloading
12:25:47 PM: .../sharp@0.32.6/node_modules/sharp install: sharp: Integrity check passed for linux-x64
12:25:48 PM: .../sharp@0.32.6/node_modules/sharp install: Done
12:25:48 PM: .../sharp@0.33.2/node_modules/sharp install$ node install/check
12:25:48 PM: .../esbuild@0.19.11/node_modules/esbuild postinstall$ node install.js
12:25:48 PM: .../esbuild@0.19.11/node_modules/esbuild postinstall: Done
12:25:49 PM: .../sharp@0.33.2/node_modules/sharp install: Done

But sharp can’t be found during build:

12:25:59 PM:   Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.

Things I’ve tried:

  • updating sharp (pnpm update sharp --latest)
    • updating astro
  • Clear cache and retry with latest branch commit

The error is still being thrown. :disappointed_relieved: Any help is appreciated!

I believe this is related to pnpm. The directory structure might not be exactly as expected to find sharp. You can potentially use Netlify Image CDN directly: Netlify Image CDN | Netlify Docs to transferm images on the fly instead of during build.

Thank you for the tip Hrishikesh! Since that Netlify Image CDN is in beta, I’ve opted to just use the no-op image service for now: Images | Docs