Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
healthcheck
✓ const healthcheck = require('healthcheck-middleware')
CJS default export. No ESM or named exports provided.
healthcheck (as middleware)
✓ app.use('/healthcheck', healthcheck())
✗ app.use('/healthcheck', healthcheck)
healthcheck is a factory function, not a middleware directly.
healthcheck (with options)
✓ const healthcheck = require('healthcheck-middleware'); app.use('/healthcheck', healthcheck({ addChecks: ... }))
✗ const healthcheck = require('healthcheck-middleware')({ addChecks: ... }); app.use('/healthcheck', healthcheck)
Do not call the factory prematurely; pass options at middleware creation.
Example showing custom checks and health info formatting with Express middleware.
const express = require('express');
const healthcheck = require('healthcheck-middleware');
const app = express();
app.use('/healthcheck', healthcheck({
addChecks: (fail, pass) => {
// Simulate async check
setTimeout(() => {
if (Math.random() > 0.5) {
pass({ db: 'connected' });
} else {
fail(new Error('Database unreachable'));
}
}, 100);
},
healthInfo: (info) => ({
status: info.status,
uptime: info.uptime,
custom: 'value'
})
}));
app.listen(3000);
Errors
Common errors & fixes
TypeError: healthcheck is not a function
Using ESM import (import) on CJS-only module, or misspelling require.
fixUse const healthcheck = require('healthcheck-middleware'); TypeError: app.use() requires middleware function
Passing the factory result (healthcheck()) instead of the factory itself to app.use.
fixapp.use('/healthcheck', healthcheck({...})); TypeError: fail is not a function
addChecks signature expected (fail, pass) but you used different parameter order or forgot to provide callback.
fixAdd a function that takes two arguments: function(fail, pass) {...} Audit
Dependencies
No dependency data recorded yet.