Next.js Discord

Discord Forum

Plaiceholder - TypeError: Native module not found: sharp

Unanswered
Briquet Griffon Vendéen posted this in #help-forum
Open in Discord
Briquet Griffon VendéenOP
Hi,

Im trying to set up plaiceholder in a client component, im using a server action to blur the image. Problem im having is when it runs i keep getting the error "TypeError: Native module not found: sharp"

Has anyone any idea where i am going wrong?

"use server";
import { getPlaiceholder } from "plaiceholder";

export async function useBlurImageData(imageUrl: string) {

  try {
    const src = "https://images.unsplash.com/photo-1621961458348-f013d219b50c";

    const buffer = await fetch(src).then(async (res) =>
      Buffer.from(await res.arrayBuffer())
    );

    const { base64 } = await getPlaiceholder(buffer);

    console.log(base64);
  } catch (err) {
    err;
  }
}

1 Reply

Briquet Griffon VendéenOP
My package.json