FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: ERROR: Transforming const to the configured target environment ("es5") is not supported

Fresh3 days ago
Mar 14, 20260 views
Confidence Score74%
74%

Problem

What version of `drizzle-orm` are you using? 0.27.0 What version of `drizzle-kit` are you using? 0.19.2 Describe the Bug Created a new next13 project and setup drizzle/drizzle kit using the quick start https://orm.drizzle.team/kit-docs/quick. Tried to run the generate script - `dirzzle-kit generate:pg` and got the following error: [code block] Downgrading to version 0.18.1 and 0.26.5 runs the generate command successfully not sure why this occurs with the latest version Expected behavior Run generate migrations successfully with drizzle kit version `0.19.2` and nextjs 13 Environment & setup _No response_

Error Output

Error: Transform failed with 1 error:

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Upgrade drizzle-orm and drizzle-kit for compatibility

Medium Risk

The error occurs due to an incompatibility between the versions of drizzle-orm (0.27.0) and drizzle-kit (0.19.2). The latest version of drizzle-orm may have introduced changes that are not fully supported by drizzle-kit version 0.19.2, particularly in how TypeScript handles certain transformations for ES5 targets.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Upgrade drizzle-orm to a compatible version

    Update drizzle-orm to a version that is known to work with drizzle-kit 0.19.2. Check the documentation for the latest compatible version.

    bash
    npm install drizzle-orm@0.26.5
  2. 2

    Verify TypeScript configuration

    Ensure that your TypeScript configuration (tsconfig.json) is set up correctly for ES5. Specifically, check the 'target' and 'lib' settings.

    json
    {
      "compilerOptions": {
        "target": "es5",
        "lib": ["es5", "dom"]
      }
    }
  3. 3

    Run the generate command

    After making the above changes, attempt to run the generate command again to see if the issue persists.

    bash
    npx drizzle-kit generate:pg
  4. 4

    Check for additional dependencies

    Ensure that all other dependencies are compatible with the versions of drizzle-orm and drizzle-kit you are using. Update any outdated packages if necessary.

    bash
    npm outdated
  5. 5

    Consult documentation for breaking changes

    Review the changelogs for both drizzle-orm and drizzle-kit to identify any breaking changes that may affect your project setup.

    url
    https://orm.drizzle.team/changelog

Validation

Confirm that the generate command runs successfully without errors. Additionally, check that the generated migrations are correct and functional in your Next.js application.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbugdrizzle/kit