MacOS将Node.js升级到最新版本

Upgrade Node.js to the latest version on Mac OS

在Mac O S上将Node.js升级到最新版本

文章目录

  • [Upgrade Node.js to the latest version on Mac OS](#Upgrade Node.js to the latest version on Mac OS)
    • [1. brew](#1. brew)
    • [2. n](#2. n)
    • [3. nvm](#3. nvm)
    • [4. package](#4. package)

1. brew


If you initially installed Node.js with Homebrew, run:

如果您最初使用 Homebrew 安装 Node.js,请运行:

js 复制代码
brew update
brew upgrade node
npm install -g npm

Or as a one-liner:

或者作为一句单行:

js 复制代码
brew update && brew upgrade node && npm install -g npm

2. n

A convenient way to change versions is to use n:

更改版本的一个便捷方法是使用 n:

js 复制代码
brew install n

To install the latest version of Node.js with n:

要使用 n 安装最新版本的 Node.js:

js 复制代码
n latest

Or, to install the latest LTS version with n:

或者,使用 n 安装最新的 LTS 版本:

js 复制代码
n lts

3. nvm

Alternatively, you could use nvm instead of n:

或者,您可以使用 nvm 而不是 n:

js 复制代码
brew install nvm

To install the latest version of Node.js with nvm:

要使用 nvm 安装最新版本的 Node.js:

js 复制代码
nvm install node

4. package

If you installed via a package, then download the latest version from nodejs.org. See Installing Node.js and updating npm.
如果您通过包安装,请从 nodejs.org 下载最新版本。请参阅安装 Node.js 和更新 npm。

Run npm install -g node after following above instructions if your node version is still not updated.

如果您的节点版本仍未更新,请按照上述说明运行 npm install -g node 。

相关推荐
GentleDevin6 小时前
Mac 常用快捷键速查表
macos
GOU926 小时前
5101实验
网络·macos
柯儿的天空7 小时前
【OpenClaw 全面解析:从零到精通】第 005 篇:OpenClaw 在 macOS 上的安装与部署实战
人工智能·macos·自然语言处理·ai作画
@大迁世界10 小时前
液态玻璃屏正在侵蚀你的电池
macos·ios·objective-c·cocoa
liangshanbo121510 小时前
[特殊字符] macOS 上的 zoxide:智能目录跳转终极指南
macos·策略模式
小p11 小时前
nodejs学习6:nodejs应用的优雅退出
node.js
pop_xiaoli11 小时前
【iOS】类与对象底层
macos·ios·objective-c·cocoa·xcode
一招定胜负13 小时前
视频转写+LLM分析:课堂录音自动化处理实现
macos·ios·xcode
军哥全栈AI13 小时前
Windows11 彻底卸载Node.js(无残留,适配所有版本)
npm·node.js
困惑阿三13 小时前
全栈部署排雷手册:从 405 报错到飞书推送成功
服务器·前端·后端·nginx·阿里云·node.js·飞书