Files
BlogPosts/文章/技术类/Debian从零开始使用pnpm部署项目.md
zibright 404d8ed74f add post
2025-07-23 23:49:31 +08:00

1.1 KiB
Raw Blame History

安装nodejs22+环境

使用使用 NodeSource

首先,添加 NodeSource 的 PPA个人包存档

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -

然后安装nodejs

apt-get install -y nodejs

使用n管理器

如果你想使用 n 管理器安装最新版本,可以先安装 n

npm install -g n

然后使用 n 安装 Node.js 22

n 22

验证安装

安装完成后,可以通过以下命令验证 Node.js 是否安装成功

node -v

安装pnpm

若已安装npm

版本不确定

npm install -g pnpm

使用独立脚本安装不用安装nodejs

Windows PowerShell

Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression

在POSIX系统上

curl -fsSL https://get.pnpm.io/install.sh | sh -
# 或者使用 
# wget -qO- https://get.pnpm.io/install.sh | sh -

安装特定的版本 在运行安装脚本之前,你可以选择设置环境变量 PNPM_VERSION 来安装特定版本的 pnpm

curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=<version> sh -