执行prisma db push 报错 Downloading Prisma engines for Node-API for rhel-openssl-1.1.x []0%Error
YoungJeff
·发布于 8 个月前·28 人看过
-
这个问题,在https://github.com/prisma/prisma/discussions/18744中已经有解决过
-
但需要注意如果prisma版本在5.0.0后,因为PRISMA_MIGRATION_ENGINE_BINARY环境变量已被弃用(https://www.prisma.io/docs/orm/reference/environment-variables-reference),所以,需要PRISMA_SCHEMA_ENGINE_BINARY进行替换,PRISMA_SCHEMA_ENGINE_BINARY的下载路径,
wget https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/schema-engine.gz
- 如果第2步没有正确设置,prisma db push执行或许解决了,但是到build项目的时候,可能导致另外一个问题: https://github.com/prisma/prisma/issues/20721 (我就是因为第2步设置错了,在引出了新的问题上卡了好久)
完整解决路径
-
下载引擎,先cd到你想放的目录(比如我的是
/root/wget
),然后执行注:引擎地址的路径
https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x
根据你自己的报错地址更改wget https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/libquery_engine.so.node.gz wget https://binaries.prisma.sh/all_commits/473ed3124229e22d881cb7addf559799debae1ab/rhel-openssl-1.1.x/schema-engine.gz wget https://binaries.prisma.sh/all_commits/473ed3124229e22d881cb7addf559799debae1ab/rhel-openssl-1.1.x/prisma-fmt.gz wget https://binaries.prisma.sh/all_commits/473ed3124229e22d881cb7addf559799debae1ab/rhel-openssl-1.1.x/query-engine.gz
-
解压引擎文件
gzip -d libquery_engine.so.node.gz gzip -d schema-engine.gz gzip -d prisma-fmt.gz gzip -d query-engine.gz
-
授权
schema-engine
执行权限chomd +x schema-engine
-
设置环境变量(以mac为例)
执行
vim ~/.zshrc
添加
# wget export WGET_DIR="$HOME/wget" ENGINE_DIR="${WGET_DIR}" export PRISMA_QUERY_ENGINE_LIBRARY="${WGET_DIR}/libquery_engine.so.node" export PRISMA_QUERY_ENGINE_BINARY="${WGET_DIR}/query-engine" export PRISMA_SCHEMA_ENGINE_BINARY="${WGET_DIR}/schema-engine" export PRISMA_FMT_BINARY="${WGET_DIR}/prisma-fmt"
变量解释:
WGET_DIR:因为我把引擎下载到
/root/wget
,而$HOME代表root
-
执行
source ~/.zshrc
,使配置即刻生效
再次执行prisma db push
就没问题了