惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Recent Announcements
Recent Announcements
V
Visual Studio Blog
博客园 - 叶小钗
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
D
DataBreaches.Net
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
C
Check Point Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
M
MIT News - Artificial intelligence

Node.js Blog

Node.js — Security Bug Bounty Program Paused Due to Loss of Funding Node.js — Node.js 25.9.0 (Current) Node.js — Developing a minimally HashDoS resistant, yet quickly reversible integer hash for V8 Node.js — Node.js 25.8.2 (Current) Node.js — Node.js 24.14.1 (LTS) Node.js — Node.js 22.22.2 (LTS) Node.js — Node.js 20.20.2 (LTS) Node.js — Tuesday, March 24, 2026 Security Releases Node.js — Node.js 25.8.1 (Current) Node.js — Evolving the Node.js Release Schedule Node.js — Node.js 22.22.1 (LTS) Node.js — Node.js 20.20.1 (LTS) Node.js — Node.js 25.8.0 (Current) Node.js — Node.js 25.7.0 (Current) Node.js — Node.js 24.14.0 (LTS) Node.js — New HackerOne Signal Requirement for Vulnerability Reports Node.js — Node.js 25.6.1 (Current) Node.js — Node.js 24.13.1 (LTS) Node.js — Node.js 25.6.0 (Current) Node.js — OpenSSL Security Advisory Assessment, January 2026 Node.js — Node.js 25.5.0 (Current) Node.js — Chalk to Node.js util styleText Node.js — Node.js 25.4.0 (Current) Node.js — Mitigating Denial-of-Service Vulnerability from Unrecoverable Stack Space Exhaustion for React, Next.js, and APM Users Node.js — Node.js 22.22.0 (LTS) Node.js — Node.js 25.3.0 (Current) Node.js — Node.js 24.13.0 (LTS) Node.js — Node.js 20.20.0 (LTS) Node.js — Tuesday, January 13, 2026 Security Releases Node.js — Node.js 24.12.0 (LTS)
Node.js — Node.js v14 to v16
2025-10-28 · via Node.js Blog

AugustinMauroy

Node.js v14 to v16

!

This article covers a part of the migration from Node.js v14 to v16. 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 v14 to v16.

create-require-from-path

Node.js v16 replaced the createRequireFromPath function, deprecated in DEP0148, with the modern createRequire function. This codemod replaces calls of the deprecated function with the modern alternative mentioned.

The source code for this codemod can be found in the create-require-from-path directory.

You can find this codemod in the Codemod Registry.

npx codemod run @nodejs/create-require-from-path

Example:

- const { createRequireFromPath } = require('node:module');
+ const { createRequire } = require('node:module');

- const requireFromPath = createRequireFromPath('/path/to/module');
+ const require = createRequire('/path/to/module');

- const myModule = requireFromPath('./myModule.cjs');
+ const myModule = require('./myModule.cjs');

process-main-module

The process.mainModule property was deprecated in favor of require.main. This codemod will help you replace the old process.mainModule usage with the new require.main usage.

So the codemod handle DEP0138.

The source code for this codemod can be found in the process-main-module directory.

You can find this codemod in the Codemod Registry.

npx codemod run @nodejs/process-main-module

Example:

- if (process.mainModule === "mod.js") {
+ if (require.main === "mod.js") {
    // cli thing
  } else {
    // module thing
  }

rmdir

The fs.rmdir function was deprecated in favor of fs.rm with the { recursive: true } option. This codemod will help you replace the old fs.rmdir function with the new fs.rm function.

so this codemod handle DEP0147.

The source code for this codemod can be found in the rmdir directory.

You can find this codemod in the Codemod Registry.

npx codemod run @nodejs/rmdir

Example:

  // Using fs.rmdir with the recursive option
- fs.rmdir(path, { recursive: true }, callback);
+ // Using fs.rm with recursive and force options
+ fs.rm(path, { recursive: true, force: true }, callback);

  // Using fs.rmdirSync with the recursive option
- fs.rmdirSync(path, { recursive: true });
+ // Using fs.rmSync with recursive and force options
+ fs.rmSync(path, { recursive: true, force: true });

  // Using fs.promises.rmdir with the recursive option
- fs.promises.rmdir(path, { recursive: true });
+ // Using fs.promises.rm with recursive and force options
+ fs.promises.rm(path, { recursive: true, force: true });

tmpDir-to-tmpdir

The tmpDir function was renamed to tmpdir in Node.js v16. This codemod will help you replace all instances of tmpDir with tmpdir.

So the codemod handles DEP0022.

The source code for this codemod can be found in the tmpdir-to-tmpdir directory.

You can find this codemod in the Codemod Registry.

npx codemod run @nodejs/tmpDir-to-tmpdir

Example:

- import { tmpDir } from 'node:os';
+ import { tmpdir } from 'node:os';
- const foo = tmpDir()
+ const foo = tmpdir()