crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Node.js NPM
Question Posted on 30 Jan 2024Home >> Tutorial >> Node.js Tutorial >> Node.js NPM

Node.js NPM

Node.js Package Manager



When we say about the NPM(Node Package Manager) this will provides two main functionalities:-

  • This will provides online repositories for node.js packages/modules which are searchable on search.nodejs.org

  • This will provides command line utility to install Node.js packages, do version management and dependency management of Node.js packages.


And NPM will comes bundled with Node.js installables in versions after that v0.6.3. And we can check the version by opening Node.js command prompt and typing the following command:


npm version




NPM Version


Installing Modules using NPM



Below is the syntax to install any Node.js module:-


npm install


Now let's install a famous Node.js web framework called express:

Open the Node.js command prompt and execute the below command:


npm install express


Once you install you will see the result after installing the "express" framework.



NPM Install Express


Global vs Local Installation



When we say dependency in NPM, by default npm installs depedency in local mode. And here mode specifies the folder where Node application present. To understand this we will take an example:- if you installed express module, it created node_modules directory in the current directory where it installed express module.



NPM Node Modules

Well we can use npm ls command to get the list of all locally installed modules.

Now you need to open Node.js command prompt and execute "npm ls"



NPM List

Globally installed packages/dependencies are stored in system directory. Now let's install express module using global installation. Although it will also produce the same result but modules will be installed globally.

Open Node.js command prompt and execute the following code:-


npm install express -g




NPM install express

Here first line will tells about the module version and its location where it is getting installed.


Unintalling a Module



And to uninstall a Node.js module use the below command:


npm uninstall express




unistall NPM

The node.js module is uninstalled. YOu can verify by using the below command:-


npm ls




NPM Empty

You can see that the module is empty now.


Searching a Module



"npm search express" command is used to search express or module.


npm search express




NPM Search Express



NPM Wrapper Data
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Parts of Node.js

Install Node.js Linux

Node.js First Example

Node.js Globals

Node.js DNS






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap