Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
Node.js Tutorial
Parts of Node.js
Features of Node.js
Install Node.js Windows
Install Node.js Linux
Node.js First Example
Node.js Console
Node.js JavaScript Learn
Node.js REPL
Node.js NPM
Node.js CL Options1
Node.js CL Option2
Node.js Globals
Node.js OS
Node.js Timer
Node.js Errors
Node.js DNS
Node.js Net
Node.js Crypto
Node.js TLS/SSL
Node.js Debugger
Node.js Process
Node.js Process Example
Node.js Process Example2
Node.js Child Process
Child Process EXEC
Child Process SPAWN
Child Process Fork
Node.js Buffers
Node.js Streams
Node.js Reading Stream
Node.js Writing Stream
Node.js Piping Stream
Node.js Chaining Streams
Node.js File System Part1
Node.js File System Part2
Node.js File System Part3
Node.js Path
Node.js StringDecoder
Node.js Query String
Node.js ZLIB
Node.js Assertion
Node.js V8
Node.js Callbacks
Node.js Events
Node.js Punycode
Node.js TTY
Node.js Web Module
Node.js Upload Files
Node.js Email Send
Node.js BuiltIn Modules
Node.js Assert Code
Node.js Assert Function
Node.js console.time()
Node.js console.table()
Node.js DNS Code
Node.js cipher.final()
Node.js URL.hash API
Node.js URL.host API
Node.js URL.origin API
Node.js MySQL
Folders in Node.js
Folders Node.js part3
Rename Folder Node.js
Remove Folder Node.js
 


  

 
Node.js NPM
Question Posted on 30 Jan 2024

Home >> 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





Other Important Questions
Parts of Node.js
Install Node.js Linux
Node.js First Example
Node.js Globals
Node.js DNS







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |