What is NPM?
Downloading and Installing a package using NPM:
To download and install a package using NPM simply use:
npm install package-name
Example: We will install nodemon in our project. nodemon is a library which helps in automatically restarting the node application when a file change (inside a project) is detected. We will learn more on nodemon in this tutorial series later on.
Install nodemon using npm:
npm install nodemon
Whenever a package is installed using npm, package details are added in project’s package.json file. You can open and view it. It will contain package name and version details. Also npm creates a folder with package name inside node_modules folder.
To update a package using npm use command: npm update packagename
Example: npm update nodemon
This command will update nodemon package to its latest version.
To uninstall a package using npm use command: npm uninstall packagename
Example: npm uninstall nodemon
In the next section we will learn about http package and how to use it in our Node.js project to call and pass data Web-APIs.