The requested module 'node_modules/pg/lib/index.js' does not provide an export named 'Pool'

I try to to setup the drizzle with nuxt but I have an error. All the structure I make down above. Run the npm run dev and the error appear... Error
The requested module 'file:///nuxt-drizzle-example/node_modules/pg/lib/index.js' does not provide an export named 'Pool'

import { Pool } from 'node_modules/pg/lib/index.js';
^^^^
SyntaxError: The requested module 'node_modules/pg/lib/index.js' does not provide an export named 'Pool'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
The requested module 'file:///nuxt-drizzle-example/node_modules/pg/lib/index.js' does not provide an export named 'Pool'

import { Pool } from 'node_modules/pg/lib/index.js';
^^^^
SyntaxError: The requested module 'node_modules/pg/lib/index.js' does not provide an export named 'Pool'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
drizzle.config.ts
import { defineConfig } from 'drizzle-kit'

export default defineConfig({
dialect: 'postgresql',
schema: './server/database/schema.ts',
out: './server/database/migrations',
dbCredentials: {
url: process.env.DATABASE_URL!,
}
})
import { defineConfig } from 'drizzle-kit'

export default defineConfig({
dialect: 'postgresql',
schema: './server/database/schema.ts',
out: './server/database/migrations',
dbCredentials: {
url: process.env.DATABASE_URL!,
}
})
server/utils/drizzle.ts
import { Pool } from "pg"
import { drizzle } from "drizzle-orm/node-postgres"
import * as schema from "../database/schema"

export { sql, eq, and, or, like } from 'drizzle-orm'

export const tables = schema

const pool = new Pool({
connectionString: process.env.DATABASE_URL!,
})

export function useDatabase() {
return drizzle(pool, { schema })
}
import { Pool } from "pg"
import { drizzle } from "drizzle-orm/node-postgres"
import * as schema from "../database/schema"

export { sql, eq, and, or, like } from 'drizzle-orm'

export const tables = schema

const pool = new Pool({
connectionString: process.env.DATABASE_URL!,
})

export function useDatabase() {
return drizzle(pool, { schema })
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server