{"id":14762,"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.","status":"active","version":"24.15.0","language":"javascript","source_language":"en","source_url":"https://github.com/aredridel/node-bin-gen","tags":["javascript","runtime"],"install":[{"cmd":"npm install node","lang":"bash","label":"npm"},{"cmd":"yarn add node","lang":"bash","label":"yarn"},{"cmd":"pnpm add node","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package provides a command-line executable, not JavaScript modules. Incorrectly attempting to 'import' or 'require' 'node' as a module will fail. npm scripts correctly place the local binary in PATH.","wrong":"import { node } from 'node';","symbol":"node (in npm scripts)","correct":"{\n  \"scripts\": {\n    \"start\": \"node index.js\"\n  }\n}"},{"note":"npx provides a convenient way to execute specific versions of the 'node' binary without local installation, or to temporarily use a locally installed version. Always specify the version for clarity, e.g., 'node@lts' or 'node@20', as omitting it might use a global or cached version.","wrong":"node your-script.js","symbol":"node (npx execution)","correct":"npx node@lts your-script.js"},{"note":"After 'npm i node', the executable is placed in './node_modules/.bin/'. Directly invoking 'node' without 'npm run' or 'npx' will only work if './node_modules/.bin/' is manually added to your shell's PATH, which is generally not recommended for project-specific binaries.","wrong":"node your-script.js","symbol":"node (direct local binary)","correct":"./node_modules/.bin/node your-script.js"}],"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."},"warnings":[{"fix":"Upgrade npm to version 3 or higher before attempting global installation, or install 'node' locally within a project's `devDependencies`.","message":"Installing 'node' globally with npm@2 will fail due to npm's internal removal process, which attempts to remove the package before its installation scripts can run, causing a conflict.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Always use `npm run <script-name>` for scripts defined in `package.json` or `npx node@<version> <command>` for ad-hoc execution to ensure the project's local Node.js version is used.","message":"After local installation (`npm i node`), the `node` command in your terminal's global PATH will still refer to your system's globally installed Node.js. The locally installed binary is only automatically used within `npm run` scripts or when explicitly invoked via `npx` or its full path.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always specify the desired Node.js version when using `npx`, e.g., `npx node@lts myscript.js` or `npx node@20 myscript.js`, to guarantee the intended runtime.","message":"When using `npx node <script.js>` without a version specifier (e.g., `@lts`, `@20`), `npx` might use a globally installed Node.js, a different locally cached version, or prompt to install the latest available, potentially leading to inconsistent environments.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'18':158 '20':160 '24.15.0':80 'add':37 'align':72 'altern':116 'approach':112 'automat':36 'becom':109 'binari':3,28 'branch':99 'cadenc':94 'ci/cd':131 'command':168 'consist':49 'current':65,79 'depend':22,144 'develop':135 'distinct':56 'e.g':156 'ensur':44 'environ':129 'even':105 'even-numb':104 'everi':100 'execut':50 'facilit':8 'flexibl':151 'follow':89 'general':88 'global':61,118 'instal':4,24,62 'intend':53 'javascript':169 'latest':75 'like':121 'local':1,20,46 'lts':71,77,110,162 'major':96,148 'manag':10,120 'modules/.bin':33 'month':102 'node':7,27,32,70,157,159,161 'node.js':2,15,54,63,76,90,147 'npm':35,164 'npx':167 'number':106 'nvm':122 'offer':150 'packag':6,87 'package.json':143 'path':40 'place':30 'project':21,47,127 'project-specif':126 'provid':68,113 'public':85 'recent':84 'regular':142 'releas':78,93,145 'robust':115 'run':42 'runtim':16,139,170 'script':43,48 'setup':132 'simplifi':130 'six':101 'specif':14,128,154 'stabl':66 'system':59 'target':153 'team':134 'track':146 'tradit':92 'treat':137 'typic':108 'usag':12 'version':17,55,67,97,107,119,149,155 'volta':124 'within':31","created_at":"2026-04-20T18:43:29.658156+00:00","updated_at":"2026-04-20T18:43:29.658156+00:00","problems":[{"fix":"Use 'npm run <script-name>' if the script is defined in `package.json`, or 'npx node@lts script.js' for ad-hoc execution. Alternatively, use './node_modules/.bin/node script.js'.","cause":"Attempting to run 'node script.js' directly in the shell after local installation without using 'npm run' or 'npx'.","error":"Error: command not found: node"},{"fix":"Ensure `npm` is updated to a modern version (>=3.0.0). If installing globally, consider using `npm i --force` cautiously, or preferably, install the `node` package locally as a project dependency to avoid global conflicts.","cause":"Conflicting global installation when using older npm versions or environmental issues.","error":"npm ERR! code EEXIST"},{"fix":"Update npm by running `npm install -g npm@latest` using a compatible Node.js version, or ensure your Node.js environment matches the npm's requirements.","cause":"The installed npm version is incompatible with the currently active Node.js runtime, often seen when switching Node.js versions or having an outdated npm.","error":"npm WARN npm npm does not support Node.js <current-node-version>"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.0","cli_name":"node","cli_version":null,"type":"library","homepage":"https://nodejs.org","github":"https://github.com/aredridel/node-bin-gen","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/node","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","http-networking","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}