Verified Production Fix
[nodejs/node] node:test and async register hooks broken after 24.12.0
GH-nodejs/node#62104 • Mar 08, 2026
### ROOT CAUSE
The issue appears to be related to changes in the way Node.js handles asynchronous hooks and the `module.register` method after the 24.12.0 release. The `fetch` request made by the server to compile modules might be failing due to changes in how Node.js handles network requests or how it interacts with the `module.register` method.
### CODE FIX
To address this issue, you can try the following steps:
1. **Update Dependencies**: Ensure that all your dependencies, including `ts-loader`, are up to date. Sometimes, issues are resolved in newer versions of libraries.
2. **Modify the Loader**: Modify the `ts-loader` to use a different method for making HTTP requests. Instead of using `fetch`, you can use `http` or `https` modules provided by Node.js. This can help avoid any compatibility issues with the `fetch` API.
3. **Check for Known Issues**: Look for any known issues or bug reports related to `ts-loader` and Node.js 24.12.0 on the `ts-loader` GitHub repository or other community forums.
4. **Debugging**: Add logging to your loader to understand where the request is failing. This can help identify if the issue is with the request itself or with how Node.js is handling it.
Here is an example of how you might modify the loader to use the `http` module:
const http = require('http');
function register() {
module.register = function(module, filename) {
http.get('http://localhost:3000/compile', (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
module._compile(data, filename);
});
}).on('error', (err) => {
console.error('Error making HTTP request:', err);
});
};
}
module.exports = register;
5. **Test the Changes**: After making the changes, test your application to ensure that the issue is resolved.
If the issue persists, consider reaching out to the maintainers of `ts-loader` or the Node.js community for further assistance.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital