> Downloading Prisma engines for Node-API for rhel-openssl-1.1.x [ ] 0%Error: request to https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/libquery_engine.so.node.gz.sha256 failed, reason: connect EINVAL 0.0.254.149:80 - Local (0.0.0.0:0)这时候就需要我们手动下载到本地,然后通过环境变量来指定引擎相关库的地址:
1. 下载
wget可用时,如果不可用则本地下载后上传至服务器
在需要存放引擎地址的目录(如
/home/prisma_engines)下执行一下代码下载库:wget https://binaries.prisma.sh/all_commits/473ed3124229e22d881cb7addf559799debae1ab/rhel-openssl-1.1.x/libquery_engine.so.node.gz
wget https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/migration-engine.gz
wget https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/prisma-fmt.gz
wget https://binaries.prisma.sh/all_commits/659ef412370fa3b41cd7bf6e94587c1dfb7f67e7/rhel-openssl-1.1.x/query-engine.gz2. 解压
这时候在该目录下会出现以上四个文件的
.gz压缩包,这时候我们需要解压它们(在上面下载目录下执行):gzip -dk libquery_engine.so.node.gz
gzip -dk migration-engine.gz
gzip -dk prisma-fmt.gz
gzip -dk query-engine.gz3. 授权
给这几个解压后的文件授权;
如果是宝塔面板的话,就直接右键权限,选择www用户,授权755;
如果没有面板的话可以通过命令行授权(在上面下载目录下执行):
chmod +755 libquery_engine.so.node
chmod +755 migration-engine
chmod +755 prisma-fmt
chmod +755 query-engine4. 设置环境变量
把上面这几个文件设置在环境变量中,编辑
.bash_profile文件,当然其他环境变量文件也行(以下操作在 ~/ 文件夹下)cd ~/
vim .bash_profile然后把下面代码插入最后,其中
ENGINE_DIR为上面存放引擎文件的目录ENGINE_DIR="/home/prisma_engines"
export PRISMA_QUERY_ENGINE_LIBRARY="${ENGINE_DIR}/libquery_engine.so.node"
export PRISMA_QUERY_ENGINE_BINARY="${ENGINE_DIR}/query-engine"
export PRISMA_SCHEMA_ENGINE_BINARY="${ENGINE_DIR}/migration-engine"
export PRISMA_FMT_BINARY="${ENGINE_DIR}/prisma-fmt"然后执行
source .bash_profile 文件使之生效5. 执行查看是否正常启动
返回项目目录执行需要的命令查看是否生效,如:
npx prisma generate> 参考:
>
> github/prisma/discussions