Home>Article>Web Front-end> How to upgrade or modify the version of nodejs
This article will introduce to you how to upgrade or modify the version ofnodejs. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Sometimes we need toforceupgrade or downgrade nodejs version, at this time the problem arises, how to do it, the summary is as follows, there are two types found in total, let’s talk about changing the version of nodejs in these two cases, nvm and n are both version management libraries of nodejs, both can be It depends on personal habits. [Recommended learning: "nodejs Tutorial"]
nvm
1. Install nvm https://github. com/creationix/nvm
2. How to use it?
Use nvm ls to check the version of nodejs that has been installed locally. If not, select nvm ls-remote to view all versions that can be installed.
Uninstall nvm uninstall (version number)
Then nvm install (version number) can be downloaded. After downloading, you can use nvm use to select the version you want to use.
Possible problems:
nvm install 时提示创建文件无权限这个时候你如果sudo nvm install试下可以就没问题, 如果提示你什么什么command not find就是你的这个命令不是root用户没有安装的 , 两种解决办法: 第一个就是把他所提示的不存在的命令全局安装一下, 第二个就是修改nvm版本库的位置, 在系统启动文件(/etc/prefix)中加入export NVM_HOME=指向你的当前用户有权限的文件夹下即可 (n出现这种情况也类似只是加入的文件名称不一样export N_PREFIX=/home/lhp/n)**
n
##n Installation is as simple as npm install -g n and then you can use the n command Now, n ls will list all versions. The white ones are those you have, and the gray ones are those in the version library that you don’t have locally. You can download and uninstall with n (version number) and n remove (version number). If the permissions are not enough Just add sudo as above, n use specified version Summary nThe installation may be simpler, the functions of the two are similar, it depends on personal habits!Programming Video! !
The above is the detailed content of How to upgrade or modify the version of nodejs. For more information, please follow other related articles on the PHP Chinese website!