npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-packages-installed-version

v1.0.5

Published

Small library developed to get some or list all installed version of project dependencies in a NodeJS environment.

Readme

Node Packages Installed Version

Small library developed to get the current exact version of some or all installed dependencies in a NodeJS project.

Features

Getting started

This package was inspired by the need to know what Prisma ORM version is in currently in use while I was developing the Prisma ORM generator called "@ladislaogarcia/zod-prisma-generator".

Install

With npm:

npm install node-packages-installed-version

Usage

// Import the package
import { getNodePackagesInstalledVersion } from 'node-packages-installed-version';

// Get the installed version of all the installed dependencies
getNodePackagesInstalledVersion();
// Get the installed version of an installed dependency in particular
getNodePackagesInstalledVersion(packageName);

API

getNodePackagesInstalledVersion(packageName?)

packageName

Type: string

This is the name in npmjs.com of the package which version is required. If it is omitted, the package will retrieve all the dependencies of the project.

Only retrieves dependencies directly related with the project. It means the package only get dependencies from nivel zero.

Then, it will returns:

null; // If the package is not a dependency or if it is not installed

or this structured data with the package name as key of the data value with the version.

NPIVDependencyList {
   // Pacakge Name
  [packageName: string]: {
    name: string; // Pacakge Name
    version: {
      major: number; // Major version as number.-> Eg: 4
      minor: number; // Minor version as number.-> Eg: 2
      patch: number; // Patch version as number -> Eg: 5
      full: string; // Complete text version -> Eg: "4.2.5"
    };
  },
  [anotherPackageName: string]: {
    name: string; // Next Pacakge Name
    ...
  };
}

So it is easy to retrieve the data of any wanted package. Just use the name of the package as index of the returned data to retrieve it. And use it.

// It will retrieve the version of each dependency.
const data = getNodePackagesInstalledVersion();
// 'packageName' is the name of the package for retrieve its data.
const pkgData = data[packageName];

// That is the same as if it is done...
const pkgData = getNodePackagesInstalledVersion(packageName);

// It is depends of the project needs.

You can run a demostration that tries to retrieve the installed version of three use cases:

  1. 'Prettier': Installed dependency.
  2. 'Storybook': Not a dependency of this project.

It can run to check for non-installed dependencies. It is only required to install any package and remove it manually from inside 'node_modules'. Do not use 'npm uninstall' because it also will erase the dependency from 'package.json'.

Then, add it to 'items' array as this:

{
    packageName: '<npm-package-name-added>',
    text: 'Not Installed Dependency',
},

You can run it just typing in a terminal

npm run demo

You will receive a response like this:

Getting data from "PRETTIER" as INSTALLED DEPENDENCY
DEPS:
 {
  prettier: {
    name: 'prettier',
    version: { major: 3, minor: 5, patch: 3, full: '3.5.3' }
  }
}
Getting data from "STORYBOOK" as NOT A DEPENDENCY
DEPS:
 null