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 。

相关推荐
奔跑吧邓邓子3 小时前
npm包管理深度探索:从基础到进阶全面教程!
前端·npm·node.js
缘友一世5 小时前
macos安装mongodb
数据库·mongodb·macos
笑非不退13 小时前
macOS开发环境配置与应用开发
macos
知否技术14 小时前
为什么nodejs成为后端开发者的新宠?
前端·后端·node.js
colorknight19 小时前
1.2.3 HuggingFists安装说明-MacOS安装
人工智能·低代码·macos·huggingface·数据科学·ai agent
谢尔登19 小时前
【Node.js】worker_threads 多线程
node.js
osnet1 天前
showdoc二次开发
node.js·vue
泯泷1 天前
「生产必看」在企业环境中正确使用 Node.js 的九大原则
前端·后端·node.js
太阳火神的美丽人生1 天前
Vant WeApp 开启 NPM 遇到的问题总结
前端·npm·node.js
GEEKVIP1 天前
如何修复变砖的手机并恢复丢失的数据
macos·ios·智能手机·word·手机·笔记本电脑·iphone