How to find the version of an installed npm package in node.js ? - GeeksforGeeks

11 Feb, 2021
NPM  is a default package manager for Node.js. NPM manages all the internal as well as external packages or modules that we use in various node.js applications. Default Packages in NPM cannot fulfill the needs of the developer, so we need external packages, and we can install either locally in a particular directory on our machine or globally that are easily accessible in any location on our machine. 
Installing npm package locally using the below command: This command will install the mentioned package in our local directory.
npm install <package-name> 
Installing npm package globally using the below command: This command will install the mentioned package globally. Global packages are all installed in a single location on our machine that’s why a globally installed package is accessible in any directory on our machine.
npm install -g <package-name>
Methods to check the installed version of Node.js. packages on our machine:
Checking locally installed  Node.js packages in a particular directory using the below command.npm lsOutput:Checking globally installed packages on our machine using the below command.npm list -gOutput:Checking specific package globally installed node.js package using below command.npm ls -g <package_name>Output:Checking Local top-level domain of packages only and not all sub-packages using the below command.npm list --depth=0Output:Checking Globally Top-level domain node.js packages using the below command.npm list --depth=0 -g
Checking locally installed  Node.js packages in a particular directory using the below command.npm lsOutput:
Checking locally installed  Node.js packages in a particular directory using the below command.
npm ls
Output:
Checking globally installed packages on our machine using the below command.npm list -gOutput:
Checking globally installed packages on our machine using the below command.
npm list -g
Output:
Checking specific package globally installed node.js package using below command.npm ls -g <package_name>Output:
Checking specific package globally installed node.js package using below command.
npm ls -g <package_name>
Output:
Checking Local top-level domain of packages only and not all sub-packages using the below command.npm list --depth=0Output:
Checking Local top-level domain of packages only and not all sub-packages using the below command.
npm list --depth=0
Output:
Checking Globally Top-level domain node.js packages using the below command.npm list --depth=0 -g
Checking Globally Top-level domain node.js packages using the below command.
npm list --depth=0 -g
mridulmanochagfg
Node-npm
NodeJS-Questions
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to connect Node.js with React.js ?
Node.js Export Module
Difference between dependencies, devDependencies and peerDependencies
Mongoose Populate() Method
Mongoose find() Function
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript