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

How to upgrade nodejs version? Two upgrade methods to share

青灯夜游
青灯夜游forward
2021-04-02 10:40:273903browse

How to upgrade nodejs version? The following article will share with you two ways to upgrade the nodejs version. 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 upgrade methods to share

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 the version .

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

The above is the detailed content of How to upgrade nodejs version? Two upgrade methods to share. 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