系统要求
本页提供了 Prisma ORM 的系统要求的概述。
系统要求
本节列出了 Prisma ORM 所需的软件和支持的操作系统,以及特定操作系统的运行时依赖要求。
软件要求
最新版本的 Prisma ORM 需要以下软件
工具 | 最低要求版本 |
---|---|
Node.js | 18.8 / 20.9 / 22.11 |
TypeScript(可选) | 5.1.X |
Yarn(可选) | 1.19.2 |
- Prisma ORM 支持并测试所有 Active LTS 和 Maintenance LTS Node.js 版本。 不在这些状态(如 Current 版本)以及奇数版本的发布版本可能也有效,但不建议用于生产环境。
- TypeScript 只对 TypeScript 用户是必需的。
- 使用 Yarn 1 时,
1.19.2
是与 Prisma Client 兼容的最低版本。
另请参阅:支持的数据库版本
展开以查看早期版本
操作系统
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 版本 |
---|---|---|
Alpine | 1.1.x, 3.x | musl 1.2.x |
RHEL | 1.0.x, 1.1.x, 3.x | glibc 2.17+ |
Debian 或其他 | 1.0.x | glibc 2.19+ |
Debian 或其他 | 1.1.x, 3.x | glibc 2.24+ |
在 ARM64
(aarch64
) 架构上
发行版家族 | OpenSSL 版本 | libc 版本 |
---|---|---|
Alpine | 1.1.x, 3.x | musl 1.2.x |
RHEL | 1.0.x, 1.1.x, 3.x | glibc 2.24+ |
Debian 或其他 | 1.0.x, 1.1.x, 3.x | glibc 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
。