You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
29
+
30
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/util-print-to-console-log).
31
+
28
32
```bash
29
33
npx codemod run @nodejs/create-require-from-path
30
34
```
@@ -46,11 +50,3 @@ console.log('Hello world');
46
50
console.error('Hello world');
47
51
console.error('Hello world');
48
52
```
49
-
50
-
### Source Code
51
-
52
-
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).
53
-
54
-
### Registry Link
55
-
56
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/util-print-to-console-log).
Copy file name to clipboardExpand all lines: apps/site/pages/en/blog/migrations/v14-to-v16.mdx
+20-32Lines changed: 20 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,10 @@ This page provides a list of codemods to help you migrate your code from Node.js
20
20
21
21
Node.js v16 replaced the [`createRequireFromPath`](https://nodejs.org/api/module.html#module_module_createrequirefrompath) function, deprecated in [DEP0148](https://nodejs.org/api/deprecations.html#DEP0148), with the modern [`createRequire`](https://nodejs.org/api/module.html#module_module_createrequire) function. This codemod replaces calls of the deprecated function with the modern alternative mentioned.
22
22
23
+
The source code for this codemod can be found in the [create-require-from-path directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/create-require-from-path).
24
+
25
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/create-require-from-path).
The source code for this codemod can be found in the [create-require-from-path directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/create-require-from-path).
46
-
47
-
### Registry Link
48
-
49
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/create-require-from-path).
50
-
51
47
## `process-main-module`
52
48
53
49
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.
54
50
55
51
So the codemod handle [DEP0138](https://nodejs.org/api/deprecations.html#DEP0138).
56
52
53
+
The source code for this codemod can be found in the [process-main-module directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/process-main-module).
54
+
55
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/process-main-module).
56
+
57
57
```bash
58
58
npx codemod run @nodejs/process-main-module
59
59
```
@@ -76,18 +76,14 @@ if (require.main === 'mod.js') {
76
76
}
77
77
```
78
78
79
-
### Source Code
80
-
81
-
The source code for this codemod can be found in the [process-main-module directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/process-main-module).
82
-
83
-
### Registry Link
84
-
85
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/process-main-module).
86
-
87
79
## `process-mainModule-to-require-main`
88
80
89
81
The [`process.mainModule`](https://nodejs.org/api/process.html#process_process_mainmodule) property was deprecated ([DEP0144](https://nodejs.org/api/deprecations.html#DEP0144)) in favor of [`require.main`](https://nodejs.org/api/modules.html#modules_accessing_the_main_module). This codemod replaces calls of the deprecated property with the modern alternative mentioned.
90
82
83
+
The source code for this codemod can be found in the [process-mainModule-to-require-main directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/process-main-module).
84
+
85
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/process-mainModule-to-require-main).
86
+
91
87
```bash
92
88
npx codemod run @nodejs/process-mainModule-to-require-main
93
89
```
@@ -112,6 +108,10 @@ The `fs.rmdir` function was deprecated in favor of `fs.rm` with the `{ recursive
112
108
113
109
so this codemod handle [DEP0147](https://nodejs.org/api/deprecations.html#DEP0147).
114
110
111
+
The source code for this codemod can be found in the [rmdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/rmdir).
112
+
113
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/rmdir).
The source code for this codemod can be found in the [rmdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/rmdir).
146
-
147
-
### Registry Link
148
-
149
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/rmdir).
150
-
151
143
## `tmpDir-to-tmpdir`
152
144
153
145
The `tmpDir` function was renamed to `tmpdir` in Node.js v16. This codemod will help you replace all instances of `tmpDir` with `tmpdir`.
154
146
155
147
So the codemod handles [DEP0022](https://nodejs.org/docs/latest/api/deprecations.html#dep0022-ostmpdir).
156
148
149
+
The source code for this codemod can be found in the [tmpdir-to-tmpdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/tmpdir-to-tmpdir).
150
+
151
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/tmpDir-to-tmpdir).
152
+
157
153
```bash
158
154
npx codemod run @nodejs/tmpDir-to-tmpdir
159
155
```
@@ -171,11 +167,3 @@ import { tmpdir } from 'node:os';
171
167
172
168
constfoo=tmpdir();
173
169
```
174
-
175
-
### Source Code
176
-
177
-
The source code for this codemod can be found in the [tmpdir-to-tmpdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/tmpdir-to-tmpdir).
178
-
179
-
### Registry Link
180
-
181
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/tmpDir-to-tmpdir).
Copy file name to clipboardExpand all lines: apps/site/pages/en/blog/migrations/v20-to-v22.mdx
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,10 @@ So in [node.js v22](https://nodejs.org/fr/blog/release/v22.0.0#other-notable-cha
24
24
25
25
Also note that the `with` keyword as been introduce in [node.js v18.20](https://nodejs.org/fr/blog/release/v18.20.0#added-support-for-import-attributes) but it was not mandatory until v22.
26
26
27
+
The source code for this codemod can be found in the [import-assertions-to-attributes directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/import-assertions-to-attributes).
28
+
29
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/import-assertions-to-attributes).
30
+
27
31
```bash
28
32
npx codemod run @nodejs/import-assertions-to-attributes
importjsonDatafrom'./data.json' with { type: 'json' };
39
43
```
40
-
41
-
### Source Code
42
-
43
-
The source code for this codemod can be found in the [import-assertions-to-attributes directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/import-assertions-to-attributes).
44
-
45
-
### Registry Link
46
-
47
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/import-assertions-to-attributes).
Read this issue to learn where we are in the process. And how to manually migrate your code.
20
+
</a>
15
21
</AlertBox>
16
22
17
-
This page provides a list of codemods to help you migrate your code from Node.js v22 to v24.
23
+
With the release of [Node.js 24.11.0](https://nodejs.org/blog/release/v24.11.0), the Node.js 24 release line has entered Long-Term Support (LTS) and will continue to receive updates through to the end of April 2028.
24
+
25
+
If you are migrating from Node.js 22 LTS, the following summarizes the breaking changes that came in [Node.js 23.0.0](https://nodejs.org/blog/release/v23.0.0) and [Node.js 24.0.0](https://nodejs.org/blog/release/v24.0.0).
26
+
27
+
### Platform support
28
+
29
+
Node.js no longer provides [pre-built binaries](https://nodejs.org/en/download) for:
30
+
31
+
- 32-bit Windows (x86) as of Node.js 23.0.0.
32
+
- 32-bit Linux on armv7 as of Node.js 24.0.0.
33
+
34
+
Pre-built binaries for macOS now require a minimum of macOS 13.5.
35
+
36
+
Pre-built binaries for Linux on arm64, ppc64le, s390x and x64 continue to be compatible with glibc 2.28 and above (no change from Node.js 22).
37
+
38
+
Please refer to [additional notes if you are building Node.js from source](#building-nodejs-from-source).
39
+
40
+
### Breaking changes
41
+
42
+
### OpenSSL 3.5
43
+
44
+
Pre-built binaries of Node.js 24 LTS, or builds using the default build configuration options, include OpenSSL 3.5. Node.js 24 LTS uses the default security level from OpenSSL 3.5 of `2`, which means that:
45
+
46
+
- RSA, DSA and DH keys shorter than 2048 bits and ECC keys shorter than 224 bits are prohibited.
47
+
- Any cipher suite using RC4 is also prohibited.
18
48
19
-
## `fs-access-mode-constants`
49
+
If you rely on older keys or weak ciphers, test your workloads against Node.js 24 builds (or adjust key/cipher choices) before upgrading.
50
+
51
+
### Other behavioral changes and argument validation
52
+
53
+
The release includes a number of behavior and validation changes (stricter `fetch()` compliance, AbortSignal validation, stream/pipe errors now throwing, changes to Buffer behavior, path handling fixes on Windows, test runner defaults, and more). See the full list below.
54
+
55
+
### C/C++ addons
56
+
57
+
Addons linking against V8 APIs may need updates for V8 13.6; C++20 support may be required where previously C++17 was used. Where possible, prefer NODE-API to reduce rebuild churn.
58
+
59
+
### Building Node.js from source
60
+
61
+
If you are building Node.js from source, you may need to update your compiler toolchain:
62
+
63
+
- For AIX and Linux platforms, the minimum supported version of [gcc](https://gcc.gnu.org/) is 12.2.
64
+
- For macOS the minimum supported version of [Xcode](https://developer.apple.com/xcode/) is 16.1.
65
+
66
+
Node.js' `configure` script will warn if you attempt to build Node.js with a compiler toolchain that does not meet the minimum supported version but will not actively prevent you from trying.
67
+
68
+
## Available Codemods
69
+
70
+
Some breaking changes or End of Life deprecations in Node.js 23 and 24 have associated codemods to help you update your codebase. Below is a list of the available codemods for this migration:
71
+
72
+
### `fs-access-mode-constants`
20
73
21
74
In Node.js 24, the `fs` module introduced a runtime deprecation for `F_OK`, `R_OK`, `W_OK`, and `X_OK` getters exposed directly on `node:fs`. Get them from `fs.constants` or `fs.promises.constants` instead.
22
75
23
76
This codemod handles [DEP0176](https://nodejs.org/api/deprecations.html#DEP0176).
24
77
78
+
The source code for this codemod can be found in the [fs-access-mode-constants directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/fs-access-mode-constants).
79
+
80
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/fs-access-mode-constants).
In Node.js v23, the `util.log` function was deprecated in favor of using `console.log` directly. Because it's an unmaintained legacy API that was exposed to user land by accident
42
105
43
106
So this codemod handle [DEP0059](https://nodejs.org/api/deprecations.html#DEP0059).
The [`zlib.bytesRead`](https://nodejs.org/api/zlib.html#zlib_bytesread) property was deprecated ([DEP0108](https://nodejs.org/api/deprecations.html#DEP0108)) in favor of [`zlib.bytesWritten`](https://nodejs.org/api/zlib.html#zlib_byteswritten). This codemod replaces `zlib.bytesRead` with `zlib.bytesWritten` for consistent stream property naming. It handles both CommonJS and ESM imports.
60
127
128
+
The source code for this codemod can be found in the [zlib-bytesRead-to-bytesWritten directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/zlib-bytesread-to-byteswritten).
129
+
130
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/zlib-bytesread-to-byteswritten).
131
+
61
132
```bash
62
-
npx codemod run @nodejs/zlib-bytesRead-to-bytesWritten
133
+
npx codemod run @nodejs/zlib-bytesread-to-byteswritten
63
134
```
64
135
65
-
### Example:
136
+
####Example:
66
137
67
138
```js displayName="Before"
68
139
constzlib=require('node:zlib');
@@ -80,15 +151,19 @@ gzip.on('end', () => {
80
151
});
81
152
```
82
153
83
-
## `fs-truncate-to-ftruncate`
154
+
###`fs-truncate-to-ftruncate`
84
155
85
156
The [`fs.truncate`](https://nodejs.org/api/fs.html#fs_fs_truncate_path_len_callback) function was deprecated ([DEP0081](https://nodejs.org/api/deprecations.html#DEP0081)) when used with a file descriptor. Use [`fs.ftruncate`](https://nodejs.org/api/fs.html#fs_fs_ftruncate_fd_len_callback) instead.
86
157
158
+
The source code for this codemod can be found in the [fs-truncate-fd-deprecation directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/fs-truncate-fd-deprecation).
159
+
160
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/fs-truncate-to-ftruncate).
161
+
87
162
```bash
88
163
npx codemod run @nodejs/fs-truncate-to-ftruncate
89
164
```
90
165
91
-
### Example:
166
+
####Example:
92
167
93
168
```js displayName="Before"
94
169
const { truncate, open, close } =require('node:fs');
Codemod to handle Node.js crypto deprecation [DEP0154](https://nodejs.org/docs/latest/api/deprecations.html#DEP0154) by transforming deprecated RSA-PSS key generation options.
120
195
196
+
The source code for this codemod can be found in the [crypto-rsa-pss-update directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/crypto-rsa-pss-update).
197
+
198
+
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/crypto-rsa-pss-update).
199
+
121
200
```bash
122
201
npx codemod run @nodejs/crypto-rsa-pss-update
123
202
```
124
203
125
-
### Example:
204
+
####Example:
126
205
127
206
```js displayName="Before"
128
207
constcrypto=require('node:crypto');
@@ -157,11 +236,3 @@ crypto.generateKeyPair(
157
236
}
158
237
);
159
238
```
160
-
161
-
### Source Code
162
-
163
-
The source code for this codemod can be found in the [crypto-rsa-pss-update directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/crypto-rsa-pss-update).
164
-
165
-
### Registry Link
166
-
167
-
You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/crypto-rsa-pss-update).
0 commit comments