Home > Web Front-end > JS Tutorial > body text

How to upgrade nodejs

青灯夜游
Release: 2023-01-11 09:20:09
Original
28885 people have browsed it

How to upgrade nodejs: 1. Use the n module and use the "n stable" command to upgrade to the latest stable version, and the "n latest" command to upgrade to the latest version; 2. Use the NVM tool and use "nvm install lastest" to upgrade to the latest version.

How to upgrade nodejs

The operating environment of this tutorial: centos7 system, nodejs version 14.15.4, DELL G3 computer.

Method 1: Use n to upgrade nodejs

The more powerful thing is: use Node Binary management module "n", you can use a very simple method to manage your Node versions.

# 全局安装n
$ npm install -g n

# 升级到最新稳定版
$ n stable 

# 升级到最新版
$ n latest

# 升级到定制版
$ n v7.10.0

# 切换使用版本
$ n 7.10.0 (ENTER)
Copy after login

Delete the specified version

$ n rm 7.10.0
Copy after login

Execute the script with the specified version

$ n use 7.10.0 some.js
Copy after login

Method 2: Use NVM to upgrade nodejs

Download nvm from github
Configure the project into the environment variable

$ source ~/.bashrc
$ nvm --version
Copy after login

Upgrade version

# 升级到到定制版
$ nvm install 7.10.0

# 升级到最新版
$ nvm install lastest

# 升级到稳定版
$ nvm install stable
Copy after login

Note: nvm has pitfalls when using it. It is recommended to use n to upgrade nodejs and control the version .

[Recommended learning: "nodejs tutorial"]

The above is the detailed content of How to upgrade nodejs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template