Udlei Nati
Udlei Nati
Explore posts from servers
DTDrizzle Team
Created by Udlei Nati on 1/6/2025 in #help
Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm
I replied to this issue with the example that I'm posting here: https://github.com/drizzle-team/drizzle-orm/issues/3748 I'm following the error:
error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).
error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).
You might not get the error if you have postgres package installed globally via npm. To easily reproduce it, try running it using Docker: Create a file named main.ts with the following content:
import { drizzle } from 'npm:drizzle-orm@0.38.3/postgres-js';
import postgresjs from 'https://deno.land/x/postgresjs@v3.4.5/mod.js';
const queryClient = postgresjs('postgresql://postgres:infrapsp@localhost:5432/main');
const db = drizzle(queryClient);
const result = await db.execute('select 1');
console.log(result);
import { drizzle } from 'npm:drizzle-orm@0.38.3/postgres-js';
import postgresjs from 'https://deno.land/x/postgresjs@v3.4.5/mod.js';
const queryClient = postgresjs('postgresql://postgres:infrapsp@localhost:5432/main');
const db = drizzle(queryClient);
const result = await db.execute('select 1');
console.log(result);
Now let's run it using Docker:
docker run -v $(pwd):/app -it denoland/deno:alpine-2.1.4 sh
docker run -v $(pwd):/app -it denoland/deno:alpine-2.1.4 sh
Run this command:
deno run /app/main.ts
deno run /app/main.ts
You'll see the following error:
error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).
error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).
If we switch to using postgres from npm instead of deno, it works for connections without SSL, but with SSL enabled, it returns another error:
error: Uncaught (in promise) Error: write CONNECT_TIMEOUT undefined:undefined
error: Uncaught (in promise) Error: write CONNECT_TIMEOUT undefined:undefined
The way to go it to keep it as it was in drizzle 0.30, this issue started to happening after 0.31. Does anyone have any suggestions on how to solve this issue? Best
4 replies