Skip to content
Related Articles

Related Articles

Improve Article

Node.js process.noDeprecation Property

  • Last Updated : 11 Jun, 2021

The process.noDeprecation property is an inbuilt application programming interface of the process module which is used to indicates whether the –no-deprecation flag is set on the current Node.js process. A Boolean that controls whether or not deprecation warnings are printed to stderr. Setting this to true will silence deprecation warnings. This property is used instead of the –no-deprecation command line flag.

Syntax:

process.noDeprecation

Return Value: This property indicates whether the –no-deprecation flag is set on the current Node.js process.

Below examples illustrate the use of process.noDeprecation property in Node.js:



Example 1:

Javascript




// Node.js program to demonstrate the
// process.noDeprecation Property
  
// Include process module
const process = require('process');
  
// Printing process.noDeprecation property value
console.log(process.noDeprecation);

Command to run: node –no-deprecation hello.js

Output:

true

Command to run:node hello.js

Output:

undefined

Example 2:

Javascript




// Node.js program to demonstrate the
// process.noDeprecation Property
  
// Include process module
const process = require('process');
  
// Instance Properties
process.noDeprecation = false;
  
// Printing process.noDeprecation property value
console.log(process.noDeprecation);
  
// Instance Properties
process.noDeprecation = true;
  
// Printing process.noDeprecation property value
console.log(process.noDeprecation);

Command to run: node –no-deprecation hello.js

Output:

true
true

Command to run:node hello.js

Output:

false
true

Reference: https://nodejs.org/api/process.html#process_process_nodeprecation

My Personal Notes arrow_drop_up
Recommended Articles
Page :