background
The latest LTS version is installed through the ubuntu
official apt
installation tool , and node
I am a bit of an obsessive-compulsive person . Command line command:node
ubuntu
node
npm
sudo apt install nodejs-legacy
sudo apt install npm
How to install the latest version
1. Installationnpm
sudo apt install npm
2. Upgrade npm
to the latest version
sudo npm install npm@latest -g
At this point , it npm -v
can be found that npm
the version number is the latest version 3.10.3
;
3. Install nodejs
the module for installationn
sudo npm install -g n
4. Then n
install the specified version through the nodejs
module. n
For more introduction to the module, please refer to the official documentation
//安装官方最新版本
sudo n latest
//安装官方稳定版本
sudo n stable
//安装官方最新LTS版本
sudo n lts
We install the stable version nodejs
, and then we node -v
can find that the node
installation is successful and the version number is the v6.2.0
stable version