mac切换本地node版本

1.首先安装n模块:

复制代码
sudo npm install -g n

2.升级node.js到最新稳定版

复制代码
// 升级到最新版本
sudo n latest
 
// 升级到稳定版本
sudo n stable
 
// 升级到具体版本号
sudo n xx.xx

// 最新稳定版本
sudo n lts

3.切换使用版本

复制代码
sudo n 7.10.0

4.删除指定版本

复制代码
sudo n rm 7.10.0

5.用指定版本执行脚本

复制代码
n use 7.10.0 some.js

6.可以查看所有已安装的node版本,可以根据上下和回车选择要使用的版本

复制代码
sudo n
or 
npm view node versions

9、查看当前版本

复制代码
node -v

作者:候鸟与暖风

链接:https://www.jianshu.com/p/4b11dc5a4248

来源:简书

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

相关推荐
寒水馨10 小时前
macOS下载、安装PowerShell-v7.6.4(附安装包powershell-7.6.4-osx-arm64.pkg)
macos·自动化·跨平台·shell·脚本·命令行·powershell
星辰即远方1 天前
天气预报总结
macos·ios·objective-c·cocoa
xixiaoyunya1 天前
Mac远程访问新范式:基于80KM穿云箭的内网穿透技术实践
macos
秋雨梧桐叶落莳1 天前
计算器仿写总结
学习·macos·ios·objective-c·cocoa
寒水馨2 天前
macOS下载、安装uv-0.12.0(附安装包uv-aarch64-apple-darwin.tar.gz)
python·macos·rust·项目管理·包管理器·astral·pip替代
寒水馨2 天前
macOS下载、安装protobuf-v35.1(附安装包protoc-35.1-osx-universal_binary.zip)
macos·google·grpc·序列化·protobuf·protoc·数据交换
寒水馨2 天前
macOS下载、安装ripgrep-15.2.0(附安装包ripgrep-15.2.0-aarch64-apple-darwin.tar.gz)
macos·正则表达式·rust·ripgrep·rg·命令行搜索·代码搜索
起司喵喵3 天前
Flutter-MacOS桌面OS系统|flutter.+window_manager客户端OS模板
flutter·macos·策略模式
代码对我眨眼睛3 天前
macOS Google Chrome 常用快捷键
前端·chrome·macos
啊真真真3 天前
macOS下libnfc ..写卡失败问题及解决方案
macos·策略模式