You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Prisma初始化失败:Windows环境下载引擎遇connect ETIMEDOUT错误

解决Prisma引擎下载超时(connect ETIMEDOUT)的方案

指定国内镜像源拉取引擎

Prisma默认从AWS服务器获取引擎,国内网络易超时,可通过环境变量切换到国内镜像源:

  • Windows CMD:
    set PRISMA_BINARY_MIRROR=https://registry.npmmirror.com/-/binary/prisma/
    npx prisma init
    
  • Windows PowerShell:
    $env:PRISMA_BINARY_MIRROR="https://registry.npmmirror.com/-/binary/prisma/"
    npx prisma init
    
  • Linux/macOS:
    export PRISMA_BINARY_MIRROR=https://registry.npmmirror.com/-/binary/prisma/
    npx prisma init
    

若需永久生效,可将该环境变量添加到系统配置文件(如Linux的~/.bashrc、macOS的~/.zshrc,或Windows系统环境变量)。

手动下载并放置引擎文件

  1. 找到对应4.12.0版本的引擎压缩包,根据你的操作系统(win32/linux/darwin)和架构(x64/arm64)选择对应文件。
  2. 解压后将引擎文件(如prisma-fmt.exe、query-engine)放到项目的node_modules/prisma/engines目录下。
  3. 重新执行npx prisma init。

确保npx使用代理

若npm代理生效但npx未走代理,可直接给npx指定代理:

npx --https-proxy=http://你的代理地址:端口 prisma init

也可设置全局npx代理:

npm config set proxy http://你的代理地址:端口
npm config set https-proxy http://你的代理地址:端口

代理需认证时,格式为http://用户名:密码@代理地址:端口。

切换Prisma版本

部分版本的引擎镜像同步可能存在延迟,尝试降级或升级版本:

npm install prisma@4.11.0

之后再执行npx prisma init。

内容的提问来源于stack exchange,提问作者ehmdee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 06:10:02