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 。

相关推荐
pe7er4 小时前
macOS 应用无法打开(权限问题)解决方案
macos·mac
Mr_li10 小时前
NestJS 集成 TypeORM 的最优解
node.js·nestjs
UIUV12 小时前
node:child_process spawn 模块学习笔记
javascript·后端·node.js
前端付豪2 天前
Nest 项目小实践之注册登陆
前端·node.js·nestjs
天蓝色的鱼鱼2 天前
Node.js 中间层退潮:从“前端救星”到“成本噩梦”
前端·架构·node.js
codingWhat2 天前
uniapp 多地区、多平台、多环境打包方案
前端·架构·node.js
小p2 天前
nodejs学习: 服务器资源CPU、内存、硬盘
node.js
Mr_li2 天前
手摸手,教你如何优雅的书写 NestJS 服务配置
node.js·nestjs
QQ5110082852 天前
python+springboot+django/flask的校园资料分享系统
spring boot·python·django·flask·node.js·php
q***09802 天前
最新最详细的配置Node.js环境教程
node.js