Install node, npm, cnpm [linux]

Find the latest version of node
List address: https://npm.taobao.org/mirrors/node
The latest version is v8.1.3, download address: https://npm.taobao.org/mirrors/node/v8. 1.3/node-v8.1.3-linux-x64.tar.gz

Download and install node
to create a new directory (this step can be skipped)
root# mkdir /srv/node
root# cd /srv/node
root# wget https://npm.taobao.org/mirrors/node/v8.1.3/node- v8.1.3-linux-x64.tar.gz
root# tar -zxvf node-v8.1.3-linux-x64.tar.gz

set soft chain

root# cd node-v8.1.3-linux-x64/bin/
root# ln -s /srv/node/node-v8.1.3-linux-x64/bin/node /usr/local/bin/node
root# ln -s /srv/node/node-v8.1.3-linux-x64/bin/npm /usr/local/bin/npm

View the version of node and npm
root# node --version
root# npm -v

==============================================================

Easier installation of node and npm
Installation of node and npm can also be done through the apt-get command
# sudo apt-get install nodejs
# sudo apt-get install npm

==============================================================

Install cnpm to speed up node module installation.
Since NMP sources are all abroad, downloading related resources is very slow, so it is recommended to use the domestic Taobao NPM mirror ( http://npm.taobao.org/ )
The packages installed through the cnmp command will be downloaded from Taobao NMP ,high speed.  
# npm install -g cnpm--registry= https://registry.npm.taobao.org
  

After installation, the command to install the module becomes: cnpm install [name]

# cnpm install express

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326517392&siteId=291194637