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 。

相关推荐
铁锚1 小时前
在MAC环境中安装unsloth
人工智能·python·macos·语言模型
Faith-小浩浩2 小时前
macos 多个版本的jdk
java·macos·jdk
2501_928094653 小时前
OBS - Mac专业录屏工具(Mac中文)
macos·mac·录屏
大熊猫侯佩3 小时前
拒绝羡慕 Cursor!Xcode 自己也能利用 AI 大模型让撸码如虎添翼【超详细配置】
macos·ai编程·xcode
濮水大叔6 小时前
这个Database Transaction功能多多,你用过吗?
typescript·node.js·nestjs
鹧鸪yy6 小时前
认识Node.js及其与 Nginx 前端项目区别
前端·nginx·node.js
weixin_473894776 小时前
mac 电脑安装类似 nvm 的工具,node 版本管理工具
macos·node.js
foundbug9996 小时前
Node.js导入MongoDB具体操作
数据库·mongodb·node.js
Linux运维技术栈6 小时前
多系统 Node.js 环境自动化部署脚本:从 Ubuntu 到 CentOS,再到版本自由定制
linux·ubuntu·centos·node.js·自动化