skip to Main Content

I am using Expo Sqlite with Drizzle ORM:

My drizzle.config.ts:

import  { Config } from "drizzle-kit"

export default {
  schema: "./lib/db/schema",
  out: "./lib/db/migrations",
  dialect: "sqlite",
  driver: "expo",
} satisfies Config

When I try and run npx drizzle-kit generate I get the following error:

No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/jay/Documents/personal/Code/Expo/pretty-budgeter/drizzle.config.ts'
/Users/jay/Documents/personal/Code/Expo/pretty-budgeter/node_modules/react-native/index.js:14
import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at newLoader (/Users/jay/Documents/personal/Code/Expo/pretty-budgeter/node_modules/drizzle-kit/bin.cjs:14724:13)
    at Object.newLoader (/Users/jay/Documents/personal/Code/Expo/pretty-budgeter/node_modules/drizzle-kit/bin.cjs:14724:13)
    at extensions..js (/Users/jay/Documents/personal/Code/Expo/pretty-budgeter/node_modules/drizzle-kit/bin.cjs:17252:28)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18

I’ve gone through the docs over and over again and have looked through issues on Expo’s sqlite repo and drizzle’s.

So far what I can tell is that:

  • I have set everything up correctly according to the docs.
  • Generating the migrations outside of this project and then adding them to the project works.

2

Answers


  1. Try to add "type": "module" to your package.json or rename the file to drizzle.config.mts.

    Login or Signup to reply.
  2. Check your schema, I found the same issue then I remove an imported generateId function from other file and it works

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search