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

运行npx prisma studio出现Prisma Client弃用提示如何解决?

解决 Prisma Studio 启动时的 @prisma/client/runtime 弃用警告

删除yarn.lock并执行yarn install后,每次启动npx prisma studio都会弹出以下弃用警告:

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Prisma Studio is up on http://localhost:5555
imports from "@prisma/client/runtime" are deprecated.
Use "@prisma/client/runtime/library",  "@prisma/client/runtime/data-proxy" or  "@prisma/client/runtime/binary"

以下是可行的解决步骤:

  • 确保 Prisma 版本一致
    检查package.json中prisma和@prisma/client的版本是否完全匹配,版本不匹配是触发这类警告的常见原因。执行命令查看当前版本:

    yarn list prisma
    yarn list @prisma/client
    

    若版本不一致,统一升级到最新稳定版:

    yarn add prisma@latest @prisma/client@latest
    
  • 清理并重新生成 Prisma 客户端
    删除自动生成的客户端文件目录,避免残留旧版本引用:

    rm -rf node_modules/.prisma/client
    

    重新生成客户端:

    npx prisma generate
    
  • 清理缓存并重装依赖
    清除Yarn缓存,删除旧依赖文件后重新安装:

    yarn cache clean
    rm -rf node_modules yarn.lock
    yarn install
    
  • 检查项目中的手动导入
    全局搜索项目代码,确认是否存在手动导入@prisma/client/runtime的代码。如果有,根据场景替换为警告中指定的路径:

    • 普通Node.js环境替换为@prisma/client/runtime/library
    • 使用Data Proxy的场景替换为@prisma/client/runtime/data-proxy
    • 依赖二进制文件的场景替换为@prisma/client/runtime/binary

如果以上步骤无效,可以查看Prisma的GitHub Issues确认是否为版本已知问题,或回退到之前能正常运行的Prisma版本(若有旧yarn.lock备份,恢复后重新安装即可)。

内容的提问来源于stack exchange,提问作者Spiff Jekey-Green

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.31 08:56:06