---
date: '2025-10-28T00:00:00.000Z'
category: migrations
title: Node.js v12 to v14
layout: blog-post
author: AugustinMauroy
---

# Node.js v12 to v14

<AlertBox level="info" title="!">
  This article covers a part of the migration from Node.js v12 to v14. The
  userland migrations team is working on more codemods to help you with the
  migration.
</AlertBox>

This page provides a list of codemods to help you migrate your code from Node.js v12 to v14.

## `util-print-to-console-log`

This codemod transforms calls of various now-deprecated `node:util` log functions into the modern alternative, `console.log` and `console.error`:

- [DEP0026](https://nodejs.org/api/deprecations.html#DEP0026): `util.print` → `console.log`
- [DEP0027](https://nodejs.org/api/deprecations.html#DEP0027): `util.puts` → `console.log`
- [DEP0028](https://nodejs.org/api/deprecations.html#DEP0028): `util.debug` → `console.error`
- [DEP0029](https://nodejs.org/api/deprecations.html#DEP0029): `util.error` → `console.error`

The source code for this codemod can be found in the [util-print-to-console-log directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/util-print-to-console-log).

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/util-print-to-console-log).

```bash
npx codemod run @nodejs/util-print-to-console-log
```

### Example:

```diff
- const util = require("node:util");

- util.print("Hello world");
+ console.log("Hello world");
- util.puts("Hello world");
+ console.log("Hello world");
- util.debug("Hello world");
+ console.error("Hello world");
- util.error("Hello world");
+ console.error("Hello world");
```
