文章目录
- [搜索可用的 Node.js 版本](#搜索可用的 Node.js 版本)
- [安装指定版本的 Node.js](#安装指定版本的 Node.js)
- [将 node@22 添加到 PATH](#将 node@22 添加到 PATH)
- 验证安装是否成功
- 给npm配置淘宝镜像
搜索可用的 Node.js 版本
powershell
liujinglong@192 ~ % brew search node
==> Formulae
libbitcoin-node node-build node@20 nodeenv
linode-cli node-sass node@22 nodenv
llnode node@16 node_exporter ode
node node@18 nodebrew
==> Casks
capslocknodelay nodebox
font-ubuntu-mono-derivative-powerline nodeclipse
If you meant "node" specifically:
It was migrated from homebrew/cask to homebrew/core.
安装指定版本的 Node.js
powershell
brew install node@22

将 node@22 添加到 PATH
加载配置文件
验证安装是否成功

给npm配置淘宝镜像
如果返回 https://registry.npmmirror.com,说明配置成功。
powershell
liujinglong@192 ~ % npm config set registry https://registry.npmmirror.com
liujinglong@192 ~ % npm config get registry
https://registry.npmmirror.com
liujinglong@192 ~ %