# node-version-call-local

> Call a function in a Node version found in PATH

Latest version **1.1.5** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-version-call-local
pnpm add node-version-call-local
yarn add node-version-call-local
bun add node-version-call-local
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2026-09-12 |
| First published | 2025-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=0.8 |
| Dependencies | 6 |
| Unpacked size | 84.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kevin Malakoff |
| Maintainers | kmalakoff |
| Keywords | node, version, call, exec, path, find, semver, function, worker, typescript |

## Links

- npm: https://www.npmjs.com/package/node-version-call-local
- Repository: https://github.com/kmalakoff/node-version-call-local
- Homepage: https://github.com/kmalakoff/node-version-call-local#README.md
- Issues: https://github.com/kmalakoff/node-version-call-local/issues
- npm.io page: https://npm.io/package/node-version-call-local

## Dependencies (6)

- [semver](https://npm.io/package/semver.md) 5.7.2
- [env-path-key](https://npm.io/package/env-path-key.md) ^1.0.0
- [module-compat](https://npm.io/package/module-compat.md) ^0.1.0
- [node-exec-path](https://npm.io/package/node-exec-path.md) ^1.0.0
- [function-exec-sync](https://npm.io/package/function-exec-sync.md) ^2.0.0
- [node-version-utils](https://npm.io/package/node-version-utils.md) ^1.0.2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.1.5 (latest) — 2026-09-12
- 1.1.4 — 2026-09-05
- 1.1.3 — 2026-08-24
- 1.1.2 — 2026-05-26
- 1.1.1 — 2025-12-27
- 1.1.0 — 2025-12-19
- 1.0.0 — 2025-12-19
- 0.3.2 — 2025-12-18
- 0.3.1 — 2025-12-18
- 0.3.0 — 2025-12-18
- 0.2.0 — 2025-12-18
- 0.1.0 — 2025-12-18

## README

# node-version-call-local

Call a worker function with a Node.js version already available in `PATH`. It does not install Node.js versions. Use `node-version-call` when installation is required.

## Install

```bash
npm install node-version-call-local
```

## Worker

The worker file must export a function. For example, `worker.cjs` can contain:

```js
module.exports = function (value) {
  return process.version + ': ' + value;
};
```

## Usage

```js
import { fileURLToPath } from 'url';
import { bindSync, bind } from 'node-version-call-local';

const workerPath = fileURLToPath(new URL('./worker.cjs', import.meta.url));

const syncWorker = bindSync(process.version, workerPath);
console.log(syncWorker('sync'));

const asyncWorker = bind(process.version, workerPath);
console.log(await asyncWorker('async'));

asyncWorker('callback', (err, result) => {
  if (err) throw err;
  console.log(result);
});
```

Use `callSync(version, workerPath, options?, ...args)` or `call(version, workerPath, options?, ...args)` for one-off calls. The version is a semver constraint such as `'>=18'`, `'^16'`, or `'v18.0.0'`. If no matching Node executable is available in `PATH`, the call fails.

## API

- `bindSync(version, workerPath, options?)` returns a synchronous caller. It throws worker errors.
- `bind(version, workerPath, options?)` returns a caller that supports a callback or a Promise.
- `callSync(version, workerPath, options?, ...args)` performs one synchronous call.
- `call(version, workerPath, options?, ...args)` performs one callback or Promise call.

`options.callbacks: true` tells the library that the worker expects `fn(...args, callback)` instead of returning a value or Promise. `spawnOptions` defaults to `true` and updates the child process environment so nested commands use the selected Node installation. Use `env` for custom environment variables, `moduleType` to select module detection, and `interop` to control ESM default-export handling.

---
_Source: https://npm.io/package/node-version-call-local · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
