在 Windows 上使用 PowerShell 安装
iwr https://get.pnpm.io/install.ps1 -useb | iex
其他操作系统请参考:https://pnpm.io/zh/installation
安装完成后,Windows 环境变量中已被自动添加了 PNPM_HOME 环境变量,默认值是:~/AppData/Local/pnpm 将该值修改为:D:\Program Files\pnpm 然后再将 ~/AppData/Local/pnpm/pnpm.exe 剪切到 D:\Program Files\pnpm 文件夹中。
配置淘宝镜像
pnpm config set registry http://registry.npmmirror.com
配置 store-dir、state-dir、global-dir、global-bin-dir、cache-dir
pnpm config set store-dir D:\pnpm\.pnpm-store
pnpm config set state-dir D:\pnpm\state
pnpm config set global-dir D:\pnpm\store
pnpm config set global-bin-dir D:\pnpm
pnpm config set cache-dir D:\pnpm\cache
使用 pnpm 安装 Node.js
首先,添加 D:\pnpm 到 Path 环境变量中,然后执行如下命令。
pnpm env use --global 18.12.1