---
title: "Method Deprecated Warning in Node.js"
description: "Using util.deprecate to warn users about deprecated methods. Practical notes and code examples on Method Deprecated Warning."
url: "https://h3manth.com/scribe/method-deprecated-warning-in-nodejs/"
canonical_url: "https://h3manth.com/scribe/method-deprecated-warning-in-nodejs/"
markdown_url: "https://h3manth.com/scribe/blog/method-deprecated-warning-in-nodejs.md"
publishDate: "2013-08-06T00:00:00.000Z"
author: "Hemanth HM"
category: "node"
tags: ["node","javascript"]
word_count: 68
reading_time_minutes: 1
x_markdown_tokens: 216
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Method Deprecated Warning in Node.js

> Using util.deprecate to warn users about deprecated methods. Practical notes and code examples on Method Deprecated Warning.

Warn users on deprecated methods using the `util` module.

```javascript
#!/usr/bin/env node
// __filename = hello.js

util = require('util');

exports.yo = function() {
  console.log("yo yo!");
};

exports.hello = util.deprecate(function() {
  return exports.yo();
}, '`hello` is deprecated, please use `yo` instead.');

## Usage
javascript
> greet = require("hello");
{ yo: [Function], hello: [Function: deprecated] }

> greet.hello()
`hello` is deprecated, please use `yo` instead.
yo yo!
```

Happy hacking!
