Repository navigation
repl.builtinModules doesn't contain all node.js builtin modules #57504
Description
Activity
- changed the title
[-]repl.builtinModules doesn't contain all node.js builtin modules[/-][+]`repl.builtinModules` doesn't contain all node.js builtin modules[/+]on Mar 16, 2025 - The deprecation note does recommend to use
require('node:module').builtinModulesinstead, so mayberepl.buildinModulesshould just be deprecated and removed?
SGTM, would you like to send a PR?
- The deprecation note does recommend to use
- The deprecation note does recommend to use
require('node:module').builtinModulesinstead, so mayberepl.buildinModulesshould just be deprecated and removed?
SGTM, would you like to send a PR?
Yes for sure! I'll get to it right away, but could you clarify the plan here? is the idea to land this as a breaking change for v24 and leave it as is in v23?
Or if it makes sense I can fix and deprecating it in v23 and remove it altogether in v24, if that's not too much overhead
But I am not sure how to do that (2 PRs one for v23 and one for v24?) could you advice me on how to proceed in this regard? 🙂 🙏
- The deprecation note does recommend to use
Actually sorry it's my bad,
_builtinLibshas been deprecated but not actually removed:
Lines 1871 to 1885 in ab9660b
ObjectDefineProperty(module.exports, '_builtinLibs', { __proto__: null, get: pendingDeprecation ? deprecate( () => _builtinLibs, 'repl._builtinLibs is deprecated. Check module.builtinModules instead', 'DEP0142', ) : () => _builtinLibs, set: pendingDeprecation ? deprecate( (val) => _builtinLibs = val, 'repl._builtinLibs is deprecated. Check module.builtinModules instead', 'DEP0142', ) : (val) => _builtinLibs = val, enumerable: false, configurable: true, }); So if we want to follow that I guess the correct solution here is to just deprecate
repl.builtinModulesinstead of remove it altogether, right? 🤔The first step is to doc-deprecate it, you can check the history of
deprecations.mdfor examplesReacted by Dario Piotrowicz
Version
23.8.0
Platform
Subsystem
repl
What steps will reproduce the bug?
Run
node -e 'console.log(require("node:repl").builtinModules)'and
node -e 'console.log(require("node:module").builtinModules)'and notice how the modules printed in the first command are only a subset of those printed by the second
As you can see here:

How often does it reproduce? Is there a required condition?
It can be always reproduced and there is no required condition
What is the expected behavior? Why is that the expected behavior?
According to the REPL documentation (permalink)
repl.builtinModulesshould contains a list of the names of all Node.js modulesWhat do you see instead?
Only a subset of the list
Additional information
(unless I'm mistaken)
repl.builtinModulesis basically just the same thing as the deprecated and removedrepl._builtinLibs, in its deprecation note it is also stated that the list was incompleteModules not included in
repl.builtinModulesare available in the repl itself (e.g.node:testandnode:sea)(so it's not like
repl.builtinModulesincludes only modules available in the repl)The deprecation note does recommend to use
require('node:module').builtinModulesinstead, so mayberepl.builtinModulesshould just be deprecated and removed?