
Company News
Meet the Socket Team at RSAC and BSidesSF 2026
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.
node-version-call-local
Advanced tools
Call a function in a Node version found in PATH.
This is a lightweight alternative to node-version-call that finds an existing Node in PATH rather than installing one. Use this when you need to execute code in a different Node version without the overhead of installation dependencies.
npm install node-version-call-local
import call from 'node-version-call-local';
// Call a worker in any Node > 0.12 found in PATH
const result = call('>0.12', '/path/to/worker.js', { callbacks: true }, arg1, arg2);
import { bind } from 'node-version-call-local';
// Create a bound caller
const worker = bind('>0.12', '/path/to/worker.js', { callbacks: true });
// Call it multiple times
worker(arg1, callback);
worker(arg2, callback);
call(version, workerPath, options?, ...args)Execute a file in a Node version found in PATH.
'>0.12', '>=18', '^16') or exact ('v18.0.0')Returns the result from the worker.
bind(version, workerPath, options?)Create a bound caller for repeated use.
Returns a function (...args) => result that calls the worker.
interface CallOptions {
callbacks?: boolean; // Enable callback serialization (default: true)
spawnOptions?: boolean; // Use spawnOptions for npm env setup (default: false)
env?: NodeJS.ProcessEnv; // Environment variables (default: process.env)
}
true, the worker can use callbacks that get serialized across the process boundarytrue, sets up proper npm environment (PATH, npm_* vars) for running npm commands| Feature | node-version-call-local | node-version-call |
|---|---|---|
| Version not found | Throws error | Installs it |
| Dependencies | Lightweight | Heavy (install chain) |
| Version binding | At bind time | At call time |
| Use case | Polyfills, bootstrap code | Testing, exact versions |
import { call } from 'node-version-call-local';
const major = +process.versions.node.split('.')[0];
const noHTTPS = major === 0;
function fetchFile(url, callback) {
if (noHTTPS) {
// Current Node can't do HTTPS, find one that can
try {
const result = call('>0', __filename, { callbacks: true }, url);
callback(null, result);
} catch (err) {
callback(err);
}
return;
}
// Modern Node - fetch directly
https.get(url, callback);
}
import { bind } from 'node-version-call-local';
const major = +process.versions.node.split('.')[0];
// Worker that runs npm install
const workerPath = path.join(__dirname, 'workers', 'npmInstall.js');
// Need spawnOptions for npm environment
const npmInstall = bind('>10', workerPath, { callbacks: true, spawnOptions: true });
function install(packageName, callback) {
if (major > 10) {
// Current Node is fine
runNpmInstall(packageName, callback);
return;
}
// Use older Node found in PATH
npmInstall(packageName, callback);
}
MIT
FAQs
Call a function in a Node version found in PATH
We found that node-version-call-local demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.

Research
/Security News
OpenVSX releases of Aqua Trivy 1.8.12 and 1.8.13 contained injected natural-language prompts that abuse local AI coding agents for system inspection and potential data exfiltration.