BraveheartB
Deno3y ago
21 replies
Braveheart

Prisma and deno

getting this
error: could not find package '.prisma' from referrer 'file:///Users/nikos/WebstormProjects/vanillajs-patterns/backend/node_modules/.deno/@prisma+client@5.0.0/node_modules/@prisma/client/index.js'.

from this
import { Prisma, PrismaClient } from '@prisma/client';

import { config } from 'https://deno.land/std@0.163.0/dotenv/mod.ts';
import * as bcrypt from 'https://deno.land/x/bcrypt/mod.ts';

const envVars = await config();

const prisma = new PrismaClient({
  datasources: {
    db: {
      url: envVars.DATABASE_URL,
    },
  },
});

const seedData: Prisma.UserCreateInput[] = [
  {
    name: 'Tony',
    email: 'tony@test.com',
    passwordHash: await bcrypt.hash('password', 10),
    emailVerified: true,
    customFields: {
      test: 'field',
    },
  },
  {
    name: 'Nikos',
    email: 'nikos@test.com',
    passwordHash: await bcrypt.hash('password', 10),
    emailVerified: true,
  },
];

/**
 * Seed the database.
 */

for (const u of seedData) {
  const dinosaur = await prisma.user.create({
    data: u,
  });
  console.log(`Created dinosaur with id: ${dinosaur.id}`);
}
console.log(`Seeding finished.`);

await prisma.$disconnect();


following https://github.com/denoland/examples/tree/main/with-prisma
GitHub
A simple todo app using Deno and React. Contribute to denoland/examples development by creating an account on GitHub.
examples/with-prisma at main · denoland/examples
Was this page helpful?