Skip to content

macOS 环境

1. 安装 nvm

按 nvm 官方 README 安装:

bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash

重新打开终端,或按安装脚本提示加载 ~/.zshrc / ~/.bashrc 后验证:

bash
nvm --version

2. 设置 nvm 与 npm 镜像

bash
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
npm config set registry https://registry.npmmirror.com
npm config get registry

如需长期生效,把 NVM_NODEJS_ORG_MIRROR 写入 ~/.zshrc:

bash
echo 'export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node' >> ~/.zshrc
source ~/.zshrc

3. 安装 Node.js 22.x LTS

bash
nvm install 22
nvm use 22
nvm alias default 22
node -v
npm -v

如果团队需要完全一致的补丁版本,再把 22 替换为项目约定的精确版本,例如 22.22.2

下一步

继续安装 Python 3.12.x