欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > 在MAC上面通过HomeBrew安装node和npm@指定版本

在MAC上面通过HomeBrew安装node和npm@指定版本

2025/4/25 23:34:42 来源:https://blog.csdn.net/yu_fu_a_bu/article/details/145810229  浏览:    关键词:在MAC上面通过HomeBrew安装node和npm@指定版本

文章目录

  • 搜索可用的 Node.js 版本
  • 安装指定版本的 Node.js
  • 将 node@22 添加到 PATH
  • 验证安装是否成功
  • 给npm配置淘宝镜像

搜索可用的 Node.js 版本

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    nodeclipseIf you meant "node" specifically:
It was migrated from homebrew/cask to homebrew/core.

安装指定版本的 Node.js

brew install node@22

在这里插入图片描述

将 node@22 添加到 PATH

加载配置文件
在这里插入图片描述

验证安装是否成功

在这里插入图片描述

给npm配置淘宝镜像

如果返回 https://registry.npmmirror.com,说明配置成功。

liujinglong@192 ~ % npm config set registry https://registry.npmmirror.com
liujinglong@192 ~ % npm config get registry
https://registry.npmmirror.com
liujinglong@192 ~ % 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词