跳到主要内容

系统要求

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

系统要求

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

软件要求

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

工具最低要求版本
Node.js18.8 / 20.9 / 22.11
TypeScript(可选)5.1.X
Yarn(可选)1.19.2

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

展开以查看早期版本

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 镜像,其中需要从兼容的 Debian 系统复制 libz.so.1

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