Mac系统升级node.js版本和npm版本

升级node.js版本

第一步:查询当前node.js版本

bash 复制代码
node -v

第二步:清除node.js的缓存

bash 复制代码
sudo npm cache clean -f

第三步:验证缓存是否清空

bash 复制代码
npm cache verify

第四步:安装n工具,n工具是专门用于管理node.js版本的工具

bash 复制代码
sudo npm install -g n

第五步:升级node.js版本

bash 复制代码
# 安装当前最新稳定版本
sudo n stable

# 安装当前最新版本
sudo n latest

# 安装指定版本
sudo n 20.10.0

升级npm版本

第一步:查看当前npm的版本

bash 复制代码
npm -v

第二步:升级npm的版本

bash 复制代码
# 更新到最新版本
sudo npm install -g npm@latest

# 更新到指定版本
sudo npm install -g npm@10.2.3
相关推荐
朝朝暮暮an18 小时前
Day 3|Node.js 异步模型 & Promise / async-await(Part 1)
node.js
梦帮科技1 天前
Node.js配置生成器CLI工具开发实战
前端·人工智能·windows·前端框架·node.js·json
猫头虎1 天前
如何解决 OpenClaw “Pairing required” 报错:两种官方解决方案详解
网络·windows·网络协议·macos·智能路由器·pip·scipy
Misnice1 天前
Webpack、Vite、Rsbuild区别
前端·webpack·node.js
皮卡车厘子2 天前
Mac 挂载目录
macos
毕设源码-朱学姐2 天前
【开题答辩全过程】以 基于Node.js的书籍分享平台设计与实现为例,包含答辩的问题和答案
node.js
咔咔一顿操作2 天前
轻量无依赖!autoviwe 页面自适应组件实战:从安装到源码深度解析
javascript·arcgis·npm·css3·html5
前端 贾公子2 天前
Node.js 如何处理 ES6 模块
前端·node.js·es6
良逍Ai出海2 天前
在 Windows & macOS 上安装 Claude Code,并使用第三方 Key 的完整教程
windows·macos
热爱生活的五柒2 天前
linux/mac/wsl如何使用claude code,并配置免费的硅基流动API?(官方的需要付费订阅)
linux·运维·macos