跳到主要內容

系統需求

本頁面概述了 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 映像檔,其中需要從相容的 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