[BUG]: ERROR: Transforming const to the configured target environment ("es5") is not supported
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
Upgrade drizzle-orm and drizzle-kit for compatibility
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
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.
bashnpm install drizzle-orm@0.26.5 - 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
Run the generate command
After making the above changes, attempt to run the generate command again to see if the issue persists.
bashnpx drizzle-kit generate:pg - 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.
bashnpm outdated - 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.
urlhttps://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
Alex Chen
2450 rep