1. Install Nodejs
The official website address is http://nodejs.org
But the download from foreign addresses is too slow. It is recommended to download from Taobao (https://npm.taobao.org/mirrors/node/), then unzip it and set the environment variables:
wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz tar -zxvf node-v4.4.7-linux-x64.tar.gz export PATH=$PATH:/opt/node-v4.4.7-linux-x64/bin
2. Install NMP
Download the nmp installation package, which is generally included in the nodejs package. After setting the environment variables, you can use the nmp command directly . If it is not installed, download it first:
Official website address: www.npmjs.com
Taobao address: https://npm.taobao.org/mirrors/npm/
Install using the following command:
node cli.js install npm -gf
3. Install CNPM (optional)
Since the NPM 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/)
Packages installed through the cnpm command will be downloaded from Taobao NMP, which is very fast.
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
After installation, the command to install the module becomes:
$ cnpm install [name]
The sync module command is:
$ cnpm sync connect