Node.js v12 to v14

AugustinMauroy

Node.js v12 to v14

!

This article cover 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.

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 recipe transforms calls of various now-deprecated node:util log functions into the modern alternative, console.log and console.error:

  • DEP0026: util.printconsole.log
  • DEP0027: util.putsconsole.log
  • DEP0028: util.debugconsole.error
  • DEP0029: util.errorconsole.error
npx codemod run @nodejs/create-require-from-path

Example:

const util = require('node:util');

util.print('Hello world');
util.puts('Hello world');
util.debug('Hello world');
util.error('Hello world');

Source Code

The source code for this codemod can be found in the util-print-to-console-log directory.

You can find this codemod in the Codemod Registry.

Son Güncelleme
10 Eki 2025
Okuma Süresi
1 dk.
Katkıda bulunun
Bu sayfayı düzenleyin
İçindekiler
  1. util-print-to-console-log
  2. Example:
  3. Source Code
  4. Registry Link