{"library":"node-darwin-x64","title":"Node.js Runtime (macOS x64 Binary)","description":"The `node-darwin-x64` package provides a pre-compiled Node.js runtime specifically for macOS (x64 architecture), currently at version 24.15.0. It enables developers to include a specific Node.js version directly within their project's dependencies, facilitating consistent environments for builds, tests, or embedded applications without relying on a system-wide Node.js installation. Node.js itself is an open-source, cross-platform JavaScript runtime environment that follows a predictable release cadence. New major versions are released every six months in April and October, which may introduce breaking changes. Even-numbered major versions are designated as Long Term Support (LTS) releases, offering 12 months of active support followed by 18 months of maintenance, focusing on stability and security.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-darwin-x64"],"cli":{"name":"node","version":null}},"imports":["import fs from 'node:fs';","import { createServer } from 'node:http';","import process from 'node:process';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { execSync } from 'node:child_process';\nimport { writeFileSync, unlinkSync } from 'node:fs';\nimport { join } from 'node:path';\n\n// Create a simple script to demonstrate running Node.js\nconst scriptContent = `\n  console.log('Hello from Node.js (v' + process.version + ') provided by node-darwin-x64!');\n  console.log('Current architecture:', process.arch);\n  console.log('Current platform:', process.platform);\n  console.log('Environment variable GREETING:', process.env.GREETING ?? 'not set');\n`;\n\nconst scriptFilePath = join(process.cwd(), 'hello-node.js');\nwriteFileSync(scriptFilePath, scriptContent);\n\nconsole.log('Executing script using the Node.js runtime bundled by node-darwin-x64...');\n\ntry {\n  // Option 1: Using 'npx' (recommended for convenience)\n  // 'npx' automatically finds executables installed in node_modules/.bin\n  console.log('\\n--- Running via npx ---');\n  const outputNpx = execSync('npx node hello-node.js', {\n    env: { ...process.env, GREETING: 'Hello from npx' },\n    encoding: 'utf8', \n    stdio: 'pipe' // Capture output\n  });\n  console.log(outputNpx);\n\n  // Option 2: Directly referencing the binary path\n  // Useful for explicit control or when 'npx' is not available\n  const nodeBinaryPath = join(process.cwd(), 'node_modules', '.bin', 'node');\n  console.log(`\\n--- Running directly from ${nodeBinaryPath} ---`);\n  const outputDirect = execSync(`${nodeBinaryPath} hello-node.js`, {\n    env: { ...process.env, GREETING: 'Hello directly' },\n    encoding: 'utf8', \n    stdio: 'pipe' // Capture output\n  });\n  console.log(outputDirect);\n\n} catch (error) {\n  console.error('Error running script:', error.message);\n  if (error.stderr) console.error('Stderr:', error.stderr);\n} finally {\n  unlinkSync(scriptFilePath); // Clean up the temporary script\n  console.log('\\nCleaned up temporary script: hello-node.js');\n}","lang":"javascript","description":"This quickstart demonstrates how to execute a Node.js script using the specific `node` executable provided by the `node-darwin-x64` package, leveraging `npx` or direct path access.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}