node.js更新_如何更新Node.js

node.js更新

Node.js can be installed in multiple ways on a system, and the upgrade instructions depend on how you first installed it.

Node.js可以通过多种方式安装在系统上,升级说明取决于您首次安装它的方式。

如果您使用官方软件包安装了Node (If you installed Node using the official package)

The easiest way to install Node is to download the official package from the Node.js website.

安装Node的最简单方法是从Node.js网站下载官方软件包。

Node website

The official package contains an installer that will detect the existing version of Node.js and it will overwrite it with the new one.

官方软件包包含一个安装程序,它将检测Node.js的现有版本,并将用新版本覆盖它。

如果您使用Homebres安装了Node(在macOS上) (If you installed Node using Homebres (on macOS))

Homebrew is a very popular way to install Node.js on a Mac.

Homebrew是在Mac上安装Node.js的一种非常流行的方法。

If you did use Homebrew, upgrading Node is as simple as running

如果您确实使用Homebrew,则升级Node就像运行一样简单

brew update #makes sure Homebrew is up to date
brew upgrade node

Homebrew might ask you to upgrade your xCode version to compile the package.

Homebrew可能会要求您升级xCode版本以编译该软件包。

如果您使用nvm (If you use nvm)

nvm is a popular way to run Node. It allows you to easily switch the Node version, and install new versions to try and easily rollback if something breaks, for example.

nvm是运行Node的流行方法。 例如,它使您可以轻松切换Node版本,并安装新版本以尝试并轻松回滚。

It is also very useful to test your code with old Node versions.

使用旧的Node版本测试代码也非常有用。

When you use nvm, you can check the current version you are running by typing nvm current, which will give you the same result as node -v.

使用nvm ,可以通过键入nvm current来检查正在运行的当前版本,这将为您提供与node -v相同的结果。

To list all the installed versions, run nvm ls.

要列出所有已安装的版本,请运行nvm ls

You can install a new Node release (or any old Node release, too) using nvm install <VERSION>, for example:

您可以使用nvm install <VERSION>安装新的Node版本(或任何旧的Node版本),例如:

nvm install 10.8.3

Once installed, you can set that Node.js version to be the one to use by typing

安装完成后,您可以通过键入以下内容将Node.js版本设置为要使用的版本。

nvm use 10.8.3

This will set 10.8.3 to the default Node version, system-wide.

这会将10.8.3设置为系统范围内的默认Node版本。

翻译自: https://flaviocopes.com/how-to-update-node/

node.js更新

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值