Node Package Manager

  • Npm is installed with node js. We need to install nodejs if we want to use npm.
  • All the package information is specified under package.json
  • Package.json uses JSON structure.
  • It contains the name and version of the package.
  • It contains CLI which is used for downloading packages.

Command:

The command “npm install packagename” will download the package from npm repo.

npm install 

Below screen shot shows how to install a redis package. After installation, the details and dependencies are added to package.json.

npm install redis

Below screenshot shows outcome of the program:

redius

Below screenshot shows content of package-lock.json. Which is created if not exist or updated after npm install packagename.

Below screenshot shows outcome of the program:

redius package json

The command “npm install “ will use package,json and downloads all the packages specified in package.json

Npm install
Subscribe Now