我的Umami从2.10.2拉取代码升级到2.11.3版本,Vercel在构建过程中发生以下错误:
Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-05-07 00:34:36.162 UTC failed
✗ Command failed: prisma migrate deploy
Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-05-07 00:34:36.162 UTC failed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
定位到这些关键信息:Error: P3009
、05_add_visit_id
、✗ Command failed: prisma migrate deploy
。
经过互联网搜索后找到了这篇文章。按照文章操作之后发现无法成功,于是就看到了Github上的Issue。
刚刚看到的文章也是从这个Issue里面整理出来的方法。再往下面翻就找到了前几周Vercel用户提供的解决办法。经过尝试后解决构建失败的问题🥰
解决方法
-
在Github仓库中打开
package.json
文件 -
搜索
"build-db": "npm-run-all copy-db-files build-db-client",
-
将其替换成
"build-db": "npm-run-all copy-db-files build-db-client resolve-db", "resolve-db": "prisma migrate resolve --applied '05_add_visit_id'",