CLI
NODE_OPTIONS
Supplies permitted Node options from the environment before command-line options. Audit this variable when invocations differ across environments. Tested on Node.js 22.16.0. Example output (one line per entry): ["true --no-warnings"].
Formal Syntax & Structure
nodejs syntaxnodejs
NODE_OPTIONS="--no-warnings" node app.mjsParameters & Attributes
| Name | Type | Description |
|---|---|---|
| NODE_OPTIONS | string | Allowed Node options. |
Return Value
Process output
Result depends on the invoked program.
Working Example
Example Snippetnodejs
import { execFileSync } from 'node:child_process';import { writeFileSync, mkdtempSync, rmSync } from 'node:fs';import { join } from 'node:path';import { tmpdir } from 'node:os';const dir = mkdtempSync(join(tmpdir(), 'bytemind-'));try { const result = execFileSync(process.execPath, ["-e", "console.log(process.allowedNodeEnvironmentFlags.has('--no-warnings'),process.env.NODE_OPTIONS)"], { cwd: dir, env: { PATH: process.env.PATH, HOME: dir, ...{ NODE_OPTIONS: '--no-warnings' } }, encoding: 'utf8', timeout: 3000, stdio: ['ignore', 'pipe', 'pipe'] }); console.log(result.trim());}finally { rmSync(dir, { recursive: true, force: true });}