{"library":"node-exec-path","title":"Node Executable Path Helpers","description":"The `node-exec-path` package provides utilities for locating Node.js executable paths on a system and verifying if a particular Node.js installation satisfies a given semantic version range. It offers both synchronous (`satisfiesSemverSync`) and likely asynchronous (`satisfiesSemver`) methods to perform these checks. The current stable version is 1.2.1, though recent public release notes primarily show minor dependency upgrades, suggesting a focus on stability and maintenance rather than frequent new features. Its key differentiator is the direct integration of `semver` logic to programmatically identify suitable Node.js environments, which is crucial for applications that need to ensure compatibility with specific Node.js versions, especially in environments utilizing tools like `nvm` or `volta` where multiple Node.js installations coexist. This package abstracts away the complexities of searching `PATH` and parsing version strings.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-exec-path"],"cli":null},"imports":["import { satisfiesSemverSync } from 'node-exec-path';","import { satisfiesSemver } from 'node-exec-path';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { satisfiesSemverSync } from \"node-exec-path\";\n\n// Find a Node.js executable path that satisfies Node.js version >= 18.0\nconst execPath = satisfiesSemverSync(\">=18.0\");\n\nif (execPath) {\n  console.log(`Found compatible Node.js at: ${execPath}`);\n  // You can then use child_process.execFile to run scripts with this Node.js version\n  // import { execFile } from 'node:child_process';\n  // execFile(execPath, ['-v'], (error, stdout, stderr) => {\n  //   if (error) { console.error(error); return; }\n  //   console.log(`Version found: ${stdout.trim()}`);\n  // });\n} else {\n  console.log(\"No Node.js executable found satisfying '>=18.0'.\");\n}\n\n// Example with a different range\nconst node20Path = satisfiesSemverSync(\"~20.x\");\nif (node20Path) {\n  console.log(`Found Node.js ~20.x at: ${node20Path}`);\n}","lang":"typescript","description":"Demonstrates how to synchronously find a Node.js executable path that satisfies a specified semantic version range, returning the absolute path or null.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}