我正在做一个 Nextjs 项目,想在 Vercel 上构建一个预览环境,我在其中使用 supabase(远程 postgres)作为数据库。
我也想在预览环境中运行
prisma db seed
但是我得到以下错误:
An error occurred while running the seed command:
Error: Command was killed with SIGSEGV (Segmentation fault): ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts
部署迁移的构建命令(
prisma migrate deploy
)在vercel的预览环境中成功,数据库schema与本地完全一致
按照棱镜文档中的规定,我在
package.json
中添加了以下属性
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
}
然后我将.env中的DATABASE_URL改成supabase的,然后运行
prisma db seed
,结果报错
所以我尝试直接运行
seed.ts
,并使用此命令分配更多内存:
NODE_OPTIONS="--max-old-space-size=4096" yarn ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts
但我仍然面临分段错误。
注意prisma版本是4.10.1,node版本是18.12.1