我正在使用 Expo Sqlite 和 Drizzle ORM:
我的
drizzle.config.ts
:
import { Config } from "drizzle-kit"
export default {
schema: "./lib/db/schema",
out: "./lib/db/migrations",
dialect: "sqlite",
driver: "expo",
} satisfies Config
当我尝试运行
npx drizzle-kit generate
时,出现以下错误:
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
我一遍又一遍地浏览这些文档,并浏览了 Expo 的 sqlite 存储库和 drizzle 的问题。
到目前为止我能告诉的是:
尝试将
"type": "module"
添加到 package.json 或将文件重命名为 drizzle.config.mts
。