Home  >  Article  >  Web Front-end  >  How to upgrade nodejs version? Two methods are introduced

How to upgrade nodejs version? Two methods are introduced

青灯夜游
青灯夜游forward
2021-01-29 18:58:424158browse

How to upgrade nodejs version? This article will introduce you to two methods of nodejs upgrade. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to upgrade nodejs version? Two methods are introduced

Related recommendations: "nodejs Tutorial"

Method 1: Use n to upgrade nodejs

# 全局安装n
$ npm install -g n
# 升级到最新稳定版
$ n stable 
# 升级到最新版
$ n latest
# 升级到定制版
$ n v7.10.0
# 切换使用版本
$ n 7.10.0 (ENTER)

Delete the specified version

$ n rm 7.10.0

Execute the script with the specified version

$ n use 7.10.0 some.js

Method 2: Use NVM to upgrade nodejs

github Download nvm

Configure the project into the environment variable

$ source ~/.bashrc
$ nvm --version
# 升级到到定制版
$ nvm install 7.10.0
# 升级到最新版
$ nvm install lastest
# 升级到稳定版
$ nvm install stable

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

For more programming-related knowledge, please visit: Programming Video! !

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

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete