npm.io
1.3.21 • Published 2 weeks ago

node-version-utils

Licence
MIT
Version
1.3.21
Deps
2
Size
25 kB
Vulns
0
Weekly
0

node-version-utils

Prepare cross-platform child-process options for an installed Node.js version. It puts that version's node and npm first on PATH and sets the npm prefix.

Install

npm install node-version-utils

Use

const { spawnOptions } = require('node-version-utils');
const { spawn } = require('child_process');

const options = spawnOptions('/path/to/node-install');
spawn('node', ['--version'], options).stdout.pipe(process.stdout);

Pass the installed version directory, not the path to its node executable. The returned options can be passed to Node's child-process APIs or compatible spawn libraries.

Keywords