跳到主要內容

系統要求

本頁概述了 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

© . This site is unofficial and not affiliated with Prisma Data, Inc.