Detailed steps for installing nodejs under linux

  • 2020-06-03 09:10:38
  • OfStack

Recommended methods:

//  download nvm
$ git clone

//  Install the version you need , Then you can use it in any directory node As well as npm the  
$ nvm install 7.4.0

// If the newly opened window cannot be implemented, the following two steps are required 
 // 1  This is done automatically when the configuration terminal is started , in  ~/.bashrc, ~/.bash_profile, ~/.profile,  or  ~/.zshrc  File to add the following command :(.profile In the modification pro - test effective ) 
 source ~/git/nvm/
source ~/.profile 

//  Set to run by default node version 
$ nvm alias default 0.12

//  validation  nvm ls  If it comes up default for 7.4.0  The performance of the installation is successful, after any open can be implemented node The make     with 
 default -> 7.4.0 (-> v7.4.0)

Other methods:

1. Compile package extract + configure variables

tar -zxvf node-v4.4.7-linux-x64.tar.gz
export PATH=$PATH:/opt/node-v4.4.7-linux-x64/bin

2. Source code package compilation + installation + configuration variables

3. apt - get installation

Related articles: