{"library":"node","title":"Local Node.js Binary Installer","description":"This package, `node`, facilitates the management and usage of specific Node.js runtime versions as a local project dependency. By installing it, a `node` binary is placed within `node_modules/.bin`, which npm automatically adds to the `PATH` when running scripts, ensuring that local project scripts consistently execute with the intended Node.js version, distinct from the system's globally installed Node.js. The current stable version provided through `node@lts` aligns with the latest Node.js LTS release, currently `24.15.0` as of its recent publication. The package generally follows Node.js's traditional release cadence, with major versions being branched every six months and even-numbered versions typically becoming LTS. This approach provides a robust alternative to global version managers (like `nvm` or `volta`) for project-specific environments, simplifying CI/CD setups and team development by treating the runtime as a regular `package.json` dependency. Releases track Node.js major versions, offering flexibility to target specific versions (e.g., `node@18`, `node@20`, `node@lts`) through `npm i` or `npx` commands.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node"],"cli":{"name":"node","version":null}},"imports":["{\n  \"scripts\": {\n    \"start\": \"node index.js\"\n  }\n}","npx node@lts your-script.js","./node_modules/.bin/node your-script.js"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// package.json\n// {\n//   \"name\": \"my-local-node-project\",\n//   \"version\": \"1.0.0\",\n//   \"scripts\": {\n//     \"start\": \"node index.js\",\n//     \"check-local-node\": \"node -v\"\n//   }\n// }\n\n// 1. Install the latest LTS version of Node.js locally\n// npm will place the 'node' executable in ./node_modules/.bin/\nnpm i node@lts\n\n// 2. Create an 'index.js' file:\n// index.js\nimport { readFileSync } from 'node:fs'; // Using 'node:' prefix for clarity\nimport { join } from 'node:path';\n\n// This confirms the version of Node.js that is executing this script\nconsole.log(`Hello from Node.js version: ${process.version}`);\nconsole.log(`Node.js executable path: ${process.execPath}`);\n\n// Example: Reading a local file\nconst packageJsonPath = join(process.cwd(), 'package.json');\nconst packageJsonContent = readFileSync(packageJsonPath, 'utf8');\nconsole.log('Successfully read package.json:', JSON.parse(packageJsonContent).name);\n\n// 3. To run this script using the locally installed Node.js via npm script:\n// npm start\n\n// 4. You can also use npx to run a specific version ad-hoc:\n// npx node@20 -e \"console.log(process.version)\"\n","lang":"typescript","description":"Demonstrates installing a local Node.js binary and running a simple script with it via `npm start`, confirming the `process.version` and `process.execPath` to verify local execution. Also shows ad-hoc `npx` usage.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}