Error While Using Uuid Library in Sveltekit App

Error While Using Uuid Library in Sveltekit App

I'm struggling with using uuid library in SvelteKit. When I try to generate UUID then I got this error: "Cannot find module 'uuid' imported from ..."

import { v4 as uuid } from 'uuid';

export async function POST({ request }) {
    const uuidId = uuid(); // throws "Cannot find module 'uuid' imported from ..."
    return { };
}

I'm using this uuid npm package: @types/[email protected]

2
Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.