The `module-available` package provides a synchronous utility function to determine if a given Node.js module name can be successfully resolved and loaded using the `require` mechanism. The current stable version is 1.0.6, released in early 2016. The project appears to be unmaintained, with no updates in over eight years, making it an `abandoned` project. Its core function remains stable for its intended use case: checking the existence and resolvability of modules typically found in `node_modules` or built-in Node.js modules, without actually loading them. This differentiates it from simply attempting a `try/catch` around `require`, as it specifically checks *availability* rather than *loading success*. It strictly operates within the CommonJS module resolution context.
npm install module-availableVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `module-available` to check for the presence of built-in Node.js modules and installed npm packages, both existing and non-existent, using CommonJS `require` syntax.
For CommonJS, use `const moduleAvailable = require('module-available');`. For ESM projects, you would need an alternative solution or wrap `require` in a custom utility if you must use this package.Ensure `moduleName` refers to an installed npm package name or a Node.js built-in module, not a relative path to a local file.
Evaluate alternatives if active maintenance and modern module support (ESM) are critical requirements for your project.
Use CommonJS `require` syntax: `const moduleAvailable = require('module-available');`.Verify the `require` statement is correct and executed before use: `const moduleAvailable = require('module-available');`.No dependency data recorded yet.