[BUG]: "Please install `postgres`to allow Drizzle ORM to connect to the database" 0.35.0
Problem
What version of `drizzle-orm` are you using? 0.35.0 What version of `drizzle-kit` are you using? 0.26.1 Describe the Bug Since updating from 0.34.x to 0.35.0, I'm getting the following error when building my app: [code block] But postgres (postgres-js) is already installed. A sample code that triggers the error for me: [code block] My drizzle.config.json file: [code block] I have cleared the node_modules and my Nuxt output and built everything from scratch, but error is still there. Reverting to 0.34.1 fixes the problem for now. Expected behavior _No response_ Environment & setup - MacBook Pro M1 running MacOS Sequoia - Node 22
Error Output
error when building my app:
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix Drizzle ORM Postgres Connection Error in Version 0.35.0
The error occurs because the Drizzle ORM version 0.35.0 may have introduced changes that require specific configurations or dependencies for connecting to Postgres. The error message indicates that the ORM cannot detect the installed Postgres driver, which could be due to a missing or misconfigured dependency in the project setup.
Awaiting Verification
Be the first to verify this fix
- 1
Verify Postgres Driver Installation
Ensure that the Postgres driver (`postgres-js`) is correctly installed in your project. Sometimes, the installation might not complete successfully, or the package might be missing from the dependencies.
bashnpm install postgres-js - 2
Check Drizzle Configuration
Review your `drizzle.config.json` file for any misconfigurations. Ensure that the database connection settings are correctly specified and that the driver is referenced properly.
bashcat drizzle.config.json - 3
Clear Cache and Rebuild
Clear the npm cache and rebuild your project to ensure that all dependencies are correctly linked and compiled. This can resolve issues stemming from outdated or corrupted cache files.
bashnpm cache clean --force && npm run build - 4
Update Dependencies
Ensure that both `drizzle-orm` and `drizzle-kit` are updated to their latest compatible versions. Sometimes, bugs are fixed in newer releases, so keeping dependencies up to date is crucial.
bashnpm update drizzle-orm drizzle-kit - 5
Check Node.js Compatibility
Verify that your Node.js version is compatible with the versions of `drizzle-orm` and `drizzle-kit` you are using. If necessary, consider upgrading or downgrading Node.js.
bashnode -v
Validation
To confirm the fix worked, rebuild your application and check if the error message regarding the Postgres connection disappears. Additionally, run your application and ensure that it connects to the database without issues.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep