跳到主要内容

系统要求

本页概述了 Prisma ORM 的系统要求。

系统要求

本节列出了 Prisma ORM 所需的软件和支持的操作系统,以及特定操作系统的运行时依赖项要求。

软件要求

最新版本的 Prisma ORM 需要以下软件

工具最低要求版本
Node.js18.8 / 20.9 / 22.11
TypeScript(可选)5.1.X
Yarn(可选)1.19.2
  • Prisma ORM 支持并测试所有 Active LTSMaintenance LTS 版本的 Node.js 发布版。不在这些状态(如 Current)的发布版以及奇数版本可能也有效,但不推荐用于生产环境。
  • TypeScript 仅对 TypeScript 用户是必需的。
  • 使用 Yarn 1 时,1.19.2 是与 Prisma Client 兼容的最低版本。

另请参阅:支持的数据库版本

展开查看更早版本

Prisma ORM v5

Prisma ORM v5 需要以下软件

最低要求版本
Node.js16.13 / 18.X / 20.X
TypeScript(可选)4.7.X
Yarn(可选)1.19.2

操作系统

Prisma ORM 支持 macOS、Windows 和大多数 Linux 发行版。

Linux 运行时依赖项

Prisma ORM 正常工作需要安装以下系统库

  • OpenSSL 1.0.x, 1.1.x 或 3.x
  • zlib (libz.so.1)
  • libgcc (libgcc_s.so.1)
  • C 标准库(大多数 Linux 发行版上的 glibc 或 Alpine Linux 上的 musl libc)

以下两个表格显示了每个 CPU 架构支持的 Linux 发行版系列、OpenSSL 版本和 C 标准库。

AMD64 (x86_64) 架构上

发行版系列OpenSSL 版本libc 版本
Alpine1.1.x, 3.xmusl 1.2.x
RHEL1.0.x, 1.1.x, 3.xglibc 2.17+
Debian 或其他1.0.xglibc 2.19+
Debian 或其他1.1.x, 3.xglibc 2.24+

ARM64 (aarch64) 架构上

发行版系列OpenSSL 版本libc 版本
Alpine1.1.x, 3.xmusl 1.2.x
RHEL1.0.x, 1.1.x, 3.xglibc 2.24+
Debian 或其他1.0.x, 1.1.x, 3.xglibc 2.24+

当 Prisma ORM 无法解析系统上的 OpenSSL 版本时(例如因为它未安装),它将默认使用 OpenSSL 1.1.x。

可以运行受支持 Node.js 版本的系统很可能已安装 zlib 和 libgcc。一个值得注意的例外是 Google 的 Distroless 镜像,其中 libz.so.1 需要从兼容的 Debian 系统中复制。

Windows 运行时依赖项

在 Windows 上,必须安装Microsoft Visual C++ Redistributable 2015或更高版本(在大多数现代安装中,这是默认情况)。

macOS 运行时依赖项

Prisma ORM 支持 macOS 10.15 或更高版本。除软件要求部分中列出的所有平台要求外,macOS 没有其他额外的平台特定要求。

故障排除

使用过时版本的系统要求会导致一些常见问题

无法使用 @prisma/client 构建 TypeScript 项目

问题

在运行 prisma generate 后,当你尝试对项目进行类型检查时,会看到以下错误。

./node_modules/.prisma/client/index.d.ts:10:33
Type error: Type expected.
8 | export type PrismaPromise<A> = Promise<A> & {[prisma]: true}
9 | type UnwrapTuple<Tuple extends readonly unknown[]> = {
> 10 | [K in keyof Tuple]: K extends `${number}` ? Tuple[K] extends PrismaPromise<infer X> ? X : never : never
| ^
11 | };
12 |
13 |

解决方案

将项目中的 TypeScript 依赖项升级到 Prisma ORM 支持的版本npm install -D typescript

无法使用 groupBy 预览功能

问题

当你尝试运行使用 groupBy 预览功能的应用程序时,会看到以下控制台错误

server.ts:6:25 - error TS2615: Type of property 'OR' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<ProductScalarWhereWithAggregatesInput>; OR?: Enumerable<ProductScalarWhereWithAggregatesInput>; ... 4 more ...; category?: string | StringWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} extends FieldPaths<...> ? never : K...'.
6 const grouped = await prisma.product.groupBy({
~~~~~~~~~~~~~~~~~~~~~~~~
7 by: ['category']
~~~~~~~~~~~~~~~~~~~~
8 });
~~~~
server.ts:6:48 - error TS2554: Expected 0 arguments, but got 1.
6 const grouped = await prisma.product.groupBy({
~
7 by: ['category']
~~~~~~~~~~~~~~~~~~~~
8 });
~~~

解决方案

将项目中的 TypeScript 依赖项升级到 Prisma ORM 支持的版本npm install -D typescript

© . All rights reserved.