Braveheart
Braveheart
DDeno
Created by Braveheart on 7/25/2023 in #help
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'.
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();
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
22 replies