NPM is the package manager for the Node.js platform.

To install node.js and npm in ubuntu, do the following :

# apt install nodejs

Once nodejs is installed, install npm using :

# apt install npm

This may result in an error :

The following packages have unmet dependencies:

npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

Correct the problem by installing the missing dependencies, using :

# sudo apt-get install nodejs-dev node-gyp libssl1.0-dev

Once done, install npm :

# apt install npm

This should get the node.js and npm installed in your ubuntu server.

Install packages required using :

# npm install <package-name>