我在github actions上建了一个nextjs 13站点,并静态部署到vercel上,它使用prisma,我在vercel的运行日志中得到了这个错误:
2022-12-12T01:07:00.163Z 2022-12-12T01:07:00.196Z 2581999e-981c-4f05-a35d-f6f467934166 INFO PrismaClientInitializationError: Query engine library for current platform "rhel-openssl-1.0.x" could not be found.
2022-12-12T01:07:00.163Z You incorrectly pinned it to rhel-openssl-1.0.x
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z This probably happens, because you built Prisma Client on a different platform.
2022-12-12T01:07:00.163Z (Prisma Client looked in "/var/task/node_modules/@prisma/client/runtime/libquery_engine-rhel-openssl-1.0.x.so.node")
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z Searched Locations:
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /home/runner/work/project1/project1/node_modules/@prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/@prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /tmp/prisma-engines
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
2022-12-12T01:07:00.163Z generator client {
2022-12-12T01:07:00.163Z provider = "prisma-client-js"
2022-12-12T01:07:00.163Z binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-1.1.x"]
2022-12-12T01:07:00.163Z }
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z Then run "prisma generate" for your changes to take effect.
2022-12-12T01:07:00.163Z Read more about deploying Prisma Client: https://pris.ly/d/client-generator
这是我的模式文件的外观:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-1.1.x", "rhel-openssl-1.0.x"]
}
我在vercel上找到的运行时的唯一配置如下:
有人知道我怎样改变我的github操作环境来构建vercel环境吗?vercel环境到底是什么?我正在github上构建一个使用ubuntu-latest的runner
1条答案
按热度按时间5ssjco0h1#
这个错误让我觉得你需要在Vercel中编译Prisma客户端,而不是在GitHub Actions中,这样你就可以保证Prisma客户端是为目标平台(Vercel)编译的,而不是为CI/CD平台(GitHub Actions)编译的。
这些文档可能会有所帮助:https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-vercel#vercel-build-hook
他们指出在
package.json
中使用以下命令在Vercel中构建客户端: