How-To find the version of an installed NodeJS or NPM Package

Hello Developers, Sometimes you need to know the version of installed Node.js or NPM Package to know its compatibility issues with other NPM Packages and Restful APIs, So Continuing our NodeJS Development Tutorials series, In this Guide, we are going to learn How to find the version of an installed NPM package or How to check version of installed NPM package.

See also  Enable CORS in NodeJS (ExpressJS) With and Without CORS NPM

We will show you all the methods about How to check the version of an installed package with NPM

How To Find or Check the Version of Installed NodejS NPM Package using NPM?

  • First, you need to list all the installed Node Packages using npm list for locally installed packages and npm list -g for globally installed node packages.
  • You will find list of all the installed packages with respect to your command
    $ npm list
    D:\Mean Stack Dev\final-projects\NodeJS Starter
    +-- bcrypt-nodejs@0.0.3
    +-- body-parser@1.17.2
    | +-- bytes@2.4.0
    | +-- content-type@1.0.2
    | +-- debug@2.6.7
    | +-- depd@1.1.0
    | +-- http-errors@1.6.1
    | | `-- inherits@2.0.3
    | +-- iconv-lite@0.4.15
    | +-- on-finished@2.3.0
    | | `-- ee-first@1.1.1
    | +-- qs@6.4.0
    | +-- raw-body@2.2.0
    | | `-- unpipe@1.0.0
    | `-- type-is@1.6.15
    |   +-- media-typer@0.3.0
    |   `-- mime-types@2.1.15
    +-- chai@4.0.2
    | +-- assertion-error@1.0.2
    | +-- check-error@1.0.2
    | +-- deep-eql@2.0.2
    | | `-- type-detect@3.0.0
    | +-- get-func-name@2.0.0
    | +-- pathval@1.1.0
    | `-- type-detect@4.0.3
    

     

  • In the list, you will get all the installed npm packages with its version.
  • If you want to check the version of only one node npm package npm list expres
    $ npm list express
    D:\Mean Stack Dev\final-projects\NodeJS Starter
    +-- UNMET PEER DEPENDENCY eslint@4.1.1
    `-- express@4.15.3
  • and you can also use npm list --depth=0to find out all installed packages without their dependencies and same applies for npm list -g --depth=0
    $ npm list --depth=0
    
    D:\Mean Stack Dev\final-projects\NodeJS Starter
    +-- bcrypt-nodejs@0.0.3
    +-- body-parser@1.17.2
    +-- chai@4.0.2
    +-- cheerio@1.0.0-rc.1
    +-- clockwork@0.1.4
    +-- compression@1.6.2
    +-- connect-mongo@1.3.2
    +-- dotenv@4.0.0
    +-- errorhandler@1.5.0
    +-- UNMET PEER DEPENDENCY eslint@4.1.1
    +-- eslint-config-airbnb-base@11.2.0
    +-- eslint-plugin-chai-friendly@0.3.6
    +-- eslint-plugin-import@2.6.0
    +-- express@4.15.3
    +-- express-flash@0.0.2
    +-- express-session@1.15.3
    +-- express-status-monitor@0.1.9
    +-- express-validator@3.2.0
    +-- fbgraph@1.4.1
    +-- github@9.2.0
    

That’s all folks. You can also view package.json file to find out version of installed node packages.To summarize

// To Query all properties of the currently installed package
$ npm view express
 
//To Query the description of the currently installed package
$ npm view express description
 
//To Query all versions of a package
$ npm view express versions
 
//To query the description of a specific version of a package
$ npm view express@4.15.3 description

 

Leave a Comment