--disable-warning=code-or-type


稳定性: 1.1 - 处于活跃开发中

通过 codetype 禁用特定的进程警告。

🌐 Disable specific process warnings by code or type.

process.emitWarning() 发出的警告可能包含 codetype。此选项不会发出具有匹配 codetype 的警告。

🌐 Warnings emitted from process.emitWarning() may contain a code and a type. This option will not-emit warnings that have a matching code or type.

弃用警告 列表。

🌐 List of deprecation warnings.

Node.js 核心警告类型有:DeprecationWarningExperimentalWarning

🌐 The Node.js core warning types are: DeprecationWarning and ExperimentalWarning

例如,以下脚本在使用 node --disable-warning=DEP0025 执行时不会发出 DEP0025 require('node:sys')

🌐 For example, the following script will not emit DEP0025 require('node:sys') when executed with node --disable-warning=DEP0025:

import sys from 'node:sys';const sys = require('node:sys');

例如,以下脚本将在使用 node --disable-warning=ExperimentalWarning 执行时发出 DEP0025 require('node:sys'),但不会发出任何实验性警告(例如 <=v21 中的 实验性警告:vm.measureMemory 是一个实验性功能):

🌐 For example, the following script will emit the DEP0025 require('node:sys'), but not any Experimental Warnings (such as ExperimentalWarning: vm.measureMemory is an experimental feature in <=v21) when executed with node --disable-warning=ExperimentalWarning:

import sys from 'node:sys';
import vm from 'node:vm';

vm.measureMemory();const sys = require('node:sys');
const vm = require('node:vm');

vm.measureMemory();