What is node.js?
npm (Node Packaged Modules) is the official package manager for Node.js.
Npm use
It puts modules in place so that node can find them, and manages dependency conflicts intelligently.
It is extremely configurable to support a wide variety of use cases. Most commonly, it is used to publish, discover, install, and develop node programs.
NPM will allow you to leverage 1000s of lines of others code to make your node development efficient.
After installing NPM, we will download the library called underscore. This library has dozens of utility functions.
It is an online repository for the publishing of open-source Node.js projects;
And also, it is a command-line utility for interacting with said repository that aids in package installation, version management, and dependency management.
How to install node.js and npm
For Mac
1)Go to nodejs.org.
2)Click install, (to download the pkg).
3)Open the pkg and run through the install process.
That’s it! Check it worked with a simple Hello, World! example.
For ubuntu
On the latest version of Ubuntu, you can simply:
sudo apt-get install nodejs nodejs-dev npm
On earlier versions, you might need to update your repository:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm
Then, check it worked with a simple Hello, World! example.
For Windows
Since Windows package managers are less common, we recommend just downloading the Windows binary.
Video Link for Npm in node.js