Registry / devops / lsmod
library1.0.0jsnpmunverified

Fetches the list of modules and their installed versions loaded by the entry file of a Node.js application. Version 1.0.0 is the latest stable release; the package appears stable with no active development. It is a lightweight utility that provides the actual installed version of each module, not the dependency version string. Different from other module listing tools by focusing on the root project's dependencies with minimal API.

npm install lsmod
INSTALL
IMPORT
SIG · LSMOD
L
lsmod
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lsmod
const lsmod = require('lsmod');
import lsmod from 'lsmod';
CommonJS only; no ESM exports.
default export
const modules = require('lsmod')();
const { lsmod } = require('lsmod');
require returns the function itself, not an object.
TypeScript usage
const lsmod = require('lsmod'); const modules: Record<string, string> = lsmod();
import lsmod from 'lsmod';
No TypeScript types included; use any type assertion if needed.

Shows how to call lsmod() to get an object mapping module names to their installed versions.

const lsmod = require('lsmod'); const modules = lsmod(); console.log('Installed modules:', JSON.stringify(modules, null, 2));
Debug
Known issues
gotchalsmod() only includes modules loaded by the entry file, not all installed packages in node_modules
fix
Ensure all desired modules are imported/required in the main entry file before calling lsmod().
affects: 1.0.0
gotchaReturns actual installed version, not the semver range from package.json
fix
Use the returned version for exact version detection; do not expect range strings.
affects: 1.0.0
deprecatedPackage has not been updated since 2012; may not work with modern Node.js versions
fix
Consider alternatives like require('module')._resolveFilename or using require.cache.
affects: 1.0.0
Errors
Common errors & fixes
TypeError: lsmod is not a function
Using ES6 import syntax with this CommonJS-only package.
fix
Use require('lsmod') instead of import.
Cannot find module 'lsmod'
Package not installed or not in node_modules.
fix
Run 'npm install lsmod' in the project root.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Amazon
1
Resources
packagelsmod
lsmod — npm install lsmod · libregistry