CLI
Node.js --no-warnings
Suppresses default warning printing, not the underlying behavior. Prefer resolving warnings and retain diagnostic visibility in production. Tested on Node.js 22.16.0. Example output (one line per entry): ["synthetic"].
Formal Syntax & Structure
nodejs syntaxnodejs
node --no-warnings app.mjsParameters & Attributes
| Name | Type | Description |
|---|---|---|
| app.mjs | path | Program entry. |
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, ["--no-warnings", "-e", "process.emitWarning('synthetic');process.on('warning',w=>console.log(w.message))"], { cwd: dir, env: { PATH: process.env.PATH, HOME: dir, ...{} }, encoding: 'utf8', timeout: 3000, stdio: ['ignore', 'pipe', 'pipe'] }); console.log(result.trim());}finally { rmSync(dir, { recursive: true, force: true });}