Installation and configuration of node.js and NPM

Time:2021-5-11

Installation of node.js

CentOS installation:
$ dnf module list nodejs
$ dnf module install nodejs:14
Windows installation:

https://nodejs.org/en/download/

To view the installed version:

$ node -v

NPM installation

Node.js has a built-in NPM package management tool, which does not need to be installed separately.

To view the installed version:

$ npm -v

Upgrade NPM to the latest version:

$ npm install npm -g

Configure NPM to use Taobao image source

Temporary use
$ npm install express --registry https://registry.npm.taobao.org
Permanent use
$ npm config set registry https://registry.npm.taobao.org
$ npm config get registry
$ npm info express

Return to the original official address

$ npm config set registry https://registry.npmjs.org
Use cnpm instead
$ npm install cnpm -g --registry=https://registry.npm.taobao.org
$ cnpm install express