{"id":11439,"library":"node-linux-x64","title":"Node.js (Linux x64 Distribution)","description":"The `node-linux-x64` package provides a pre-compiled Node.js runtime binary specifically for Linux x64 systems, enabling projects to manage a Node.js version (e.g., v24.15.0) as a direct dependency. Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine, known for its event-driven, non-blocking I/O model, making it ideal for scalable network applications and server-side development. Node.js currently follows a release schedule with new major 'Current' versions every six months (April and October), which may introduce breaking changes. Even-numbered major versions transition to Long Term Support (LTS) in October, receiving 12 months of active support and a further 18 months of maintenance, focusing on stability and security. As of October 2026, Node.js is transitioning to an annual major release cycle where every major version will become an LTS release.","status":"active","version":"24.15.0","language":"javascript","source_language":"en","source_url":"https://github.com/aredridel/node-bin-gen","tags":["javascript"],"install":[{"cmd":"npm install node-linux-x64","lang":"bash","label":"npm"},{"cmd":"yarn add node-linux-x64","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-linux-x64","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Modern Node.js development often uses the promises-based API for built-in modules with ESM syntax. The CommonJS `require` for `fs/promises` is incorrect.","wrong":"const { readFile } = require('fs/promises');","symbol":"readFile (from 'fs/promises')","correct":"import { readFile } from 'fs/promises';"},{"note":"While CommonJS modules allow `const http = require('http');`, ESM imports for Node.js built-in modules typically require `* as` for the entire module, as they don't have a default export.","wrong":"import http from 'http';","symbol":"http (default from 'http')","correct":"import * as http from 'http';"},{"note":"Named imports are generally preferred in ESM for clarity and tree-shaking. The CommonJS pattern `require('path')` then accessing `.join` is also valid in CJS environments.","wrong":"const path = require('path'); const joinedPath = path.join(...);","symbol":"join (from 'path')","correct":"import { join } from 'path';"}],"quickstart":{"code":"import * as http from 'http';\nimport { readFile } from 'fs/promises';\nimport { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\n// __dirname equivalent for ESM\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nconst server = http.createServer(async (req, res) => {\n  res.setHeader('Content-Type', 'text/plain');\n  if (req.url === '/') {\n    res.statusCode = 200;\n    res.end('Hello Node.js World!\\n');\n  } else if (req.url === '/readfile') {\n    try {\n      // Assuming a 'sample.txt' file exists in the same directory\n      const filePath = join(__dirname, 'sample.txt');\n      const content = await readFile(filePath, 'utf8');\n      res.statusCode = 200;\n      res.end(`File content:\\n${content}\\n`);\n    } catch (error) {\n      res.statusCode = 500;\n      res.end('Error reading file. Ensure \"sample.txt\" exists.\\n');\n    }\n  } else {\n    res.statusCode = 404;\n    res.end('Not Found\\n');\n  }\n});\n\nserver.listen(port, hostname, () => {\n  console.log(`Server running at http://${hostname}:${port}/`);\n  console.log(`Visit http://${hostname}:${port}/readfile (requires a 'sample.txt' file)`);\n  console.log(`To create 'sample.txt': echo \"Hello from sample.txt\" > sample.txt`);\n});","lang":"typescript","description":"This quickstart demonstrates a basic HTTP server in Node.js, handling root and `/readfile` routes. It showcases ESM syntax for importing built-in modules (http, fs/promises, path, url) and performing asynchronous file operations. It runs an HTTP server and reads a local file."},"warnings":[{"fix":"Always consult the official Node.js release notes and migration guides (e.g., nodejs.org/en/docs/guides/nodejs-release-post-mortem) when upgrading between major versions, especially from LTS to a newer Current or LTS release. Prioritize LTS versions for production for stability.","message":"Node.js introduces breaking changes with each new major 'Current' version, released approximately every six months (April and October). Projects should carefully review migration guides before upgrading across major versions. For instance, Node.js 24 introduced OpenSSL 3.5, restricting short RSA/DSA/DH keys and RC4 cipher suites, and had stricter validation for `fetch()` and `AbortSignal`.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Explicitly define module type in `package.json` with `\"type\": \"module\"` for ESM, or stick to `.mjs` for ESM and `.cjs` for CJS. Convert `require` calls to `import` statements and vice-versa as appropriate for the module context. Be aware of differences in `__dirname` and `__filename` availability in ESM.","message":"The Node.js module system has fundamental differences between CommonJS (CJS) and ES Modules (ESM). Attempting to use `require()` in an ES module or `import` in a CommonJS module without proper configuration (like `\"type\": \"module\"` in `package.json` or `.mjs` extensions) will lead to runtime errors like `ReferenceError: require is not defined` or `SyntaxError: Unexpected token 'export'`.","severity":"gotcha","affected_versions":">=12.0.0"},{"fix":"Develop against the latest 'Current' release for new features, but deploy and maintain production applications on 'Active LTS' release lines. Plan regular upgrades between LTS versions to stay current with security patches and improvements.","message":"For production applications, it is strongly recommended to use Long Term Support (LTS) releases of Node.js over 'Current' releases. Current releases are under active development and have a shorter support window (8 months for October releases) compared to LTS versions (30 months total support including active and maintenance phases). LTS versions focus on stability and security, making them more suitable for critical deployments.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Refactor `require()` calls to `import` statements. If a module strictly needs `require()`, ensure the file is treated as CommonJS (e.g., `.cjs` extension or no `\"type\": \"module\"` in `package.json`).","cause":"Attempting to use CommonJS `require()` syntax within an ES Module file or project configured as ESM.","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Verify the package name, ensure it's installed via `npm install some-package`, and check the import/require path. For local files, ensure the path includes `./` or `../` prefixes and the correct extension.","cause":"The module specified in `import` or `require` does not exist, is not correctly installed, or its path is incorrect.","error":"Error: Cannot find module 'some-package'"},{"fix":"Either convert the file/project to ESM (e.g., add `\"type\": \"module\"` to `package.json` or use `.mjs` extension) or refactor `export` statements to CommonJS `module.exports = ...` or `exports.name = ...`.","cause":"Attempting to use ES Module `export` syntax in a CommonJS module file or project not configured for ESM.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm"}