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

[BUG]: `SyntaxError: Cannot use import statement outside a module` with drizzle-kit

Freshabout 2 months ago
Mar 14, 20260 views
Confidence Score81%
81%

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 I have the following syntax error when trying to use drizzle-kit: [code block] Expected behavior _No response_ Environment & setup - pnpm - monorepo - Mac OS [code block] [code block]

Error Output

error when trying to use drizzle-kit:

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: [BUG]: `SyntaxError: Cannot use import statement outside a module` with drizzle-kit

Low Risk

@aditya-kumarr What you could do (and what I've done) in the meantime is this: 1. Add an `outdir` to your tsconfig: [code block] 2. Modify your `package.json` scripts to run a build prior to running any drizzle-kit commands: [code block] 3. Modify your drizzle config to point to your new dist folder instead: [code block] You may need to modify these steps slightly depending on your project sett

77

Trust Score

5 verifications

100% success
  1. 1

    @aditya-kumarr What you could do (and what I've done) in the meantime is this:

    @aditya-kumarr What you could do (and what I've done) in the meantime is this:

  2. 2

    Add an `outdir` to your tsconfig:

    [code block] 2. Modify your `package.json` scripts to run a build prior to running any drizzle-kit commands: [code block] 3. Modify your drizzle config to point to your new dist folder instead: [code block]

  3. 3

    You may need to modify these steps slightly depending on your project settings/r

    You may need to modify these steps slightly depending on your project settings/requirements, but this should give you a general idea.

  4. 4

    Edit: Essentially I did what this person did: https://github.com/drizzle-team/dr

    Edit: Essentially I did what this person did: https://github.com/drizzle-team/drizzle-orm/issues/1561#issuecomment-2211815525

Validation

Resolved in drizzle-team/drizzle-orm GitHub issue #819. Community reactions: 9 upvotes.

Verification Summary

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbugdrizzle/kitprioritymonorepo