Set up pnpm
Installation
不同场景有不同的安装方式,
如果已经有了 npm
npm i pnpm -g
脚本安装
参考官方文档
# On Windows
iwr https://get.pnpm.io/install.ps1 -useb | iex
# On POSIX systems
curl -fsSL https://get.pnpm.io/install.sh | sh -
# or
wget -qO- https://get.pnpm.io/install.sh | sh -
在 Dockerfile 中配置 pnpm 环境
FROM node:20-alpine as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# change registry, option
ENV COREPACK_NPM_REGISTRY="https://registry.npmmirror.com"
RUN corepack enable
管理 nodejs 版本
使用 LTS 版本
pnpm env use --global lts
or 指定版本
pnpm env use --global 18