Full-Stack Web Development with Vue.js and Node

(singke) #1
Introducing MEVN Chapter 1

Introducing npm


The npm is the acronym for Node Package Manager. Basically, it is a tool that takes care of
all the packages that we install for Node.js. We can find all the existing packages on the


official website (https:/​/​www.​npmjs.​com/​). npm makes it easy for developers to keep their


code updated and to reuse code shared by many other developers.


Developers are often confused by the terms package and modules. However, there is a clear
distinction between these two.


Module


A module is something that can be loaded by Node.js with a require command and has a


namespace. A module has a package.json file associated with it.


Package


A package is just a file, or group of files, that is capable of functioning on its own. Every


package also has a package.json file that contains all the metadata-related information


that describes that package. A combination of modules makes up a node package.


Installing npm


When we install Node.js from the installer itself, npm is installed as a part of the node. We


can check whether npm is installed or not by using the following command:


$ npm --version

If npm is not installed, the command displays an error, whereas if installed, it just prints out


the version of the installed npm.

Free download pdf