Repository navigation
Description
Current Behavior
With Node adding scoped built-ins like node:test and node:sqlite, I'd like to use them as modules in a Function node - but Node-RED's runtime doesn't handle these correctly, and the flow halts.
Declaring node:sqlite or node:test as a Function node module leaves the node permanently flagged invalid, with the module permanently "missing". Deploying gives a toast: "Flows stopped due to missing modules", listing both as install_not_allowed. The node itself then shows a persistent canvas error: "Invalid properties: - Module node:sqlite missing" (same for node:test). There's no working path to clear this short of removing the module.
Root cause is in @node-red/registry/lib/externalModules.js, parseModuleName():
const BUILTIN_MODULES = require('module').builtinModules;
...
if (/^node:/.test(moduleName)) {
isBuiltIn = BUILTIN_MODULES.includes(moduleName.substring(5))
} else {
isBuiltIn = BUILTIN_MODULES.includes(moduleName)
}Some builtins are listed in module.builtinModules with the node: prefix baked into the string itself, with no bare alias. On Node 24.19.0:
> require('module').builtinModules.filter(m => m.startsWith('node:'))
[ 'node:sea', 'node:sqlite', 'node:test', 'node:test/reporters' ]For node:-prefixed input, parseModuleName strips the prefix before checking the list, i.e. it checks whether bare sqlite is in the list. The list entry is the full string node:sqlite, so this never matches, and isBuiltIn comes back false. checkFlowDependencies() then treats it as an external npm dependency and calls installModule(), which runs it through validate-npm-package-name before anything else:
> require('validate-npm-package-name')('node:sqlite')
{ validForOldPackages: false, warnings: ['node:sqlite is a core module name'], errors: ['name can only contain URL-friendly characters'] }The colon isn't a valid npm package name character, so this throws before any install is attempted - surfaced to the user as install_not_allowed, matching the toast exactly. I haven't checked node:sea or node:test/reporters directly, but the same code path applies to all four.
Expected Behavior
Declaring node:sqlite (or node:sea, node:test, node:test/reporters) as a module should resolve to Node's native builtin directly, with no npm install attempted and no "missing module" state - the same way node:fs or node:path already do.
The fix looks quite narrow for node:-prefixed input, parseModuleName should also check the unstripped string against BUILTIN_MODULES (i.e. BUILTIN_MODULES.includes(moduleName) using the full node:sqlite form), not only the stripped form.
Steps To Reproduce
- Run Node-RED on Node.js 22.5+ (native
node:sqlitesupport) or Node.js 24. - Add a Function node, open the Setup tab, add a module named
node:testimported astest. - Deploy.
- Deploy toast reports "Flows stopped due to missing modules" with
node:test - install_not_allowed, and the node on the canvas is permanently flagged invalid: "Invalid properties: - Module node:test missing". - Same result with
node:sqliteimported assqlite.
Example flow
[
{
"id": "f1_tab",
"type": "tab",
"label": "node:sqlite / node:test builtin bug",
"disabled": false,
"info": ""
},
{
"id": "f1_node",
"type": "function",
"z": "f1_tab",
"name": "check sqlite + test",
"func": "node.warn(typeof sqlite.DatabaseSync);\nnode.warn(typeof test.test);\nreturn msg;",
"outputs": 1,
"timeout": 0,
"libs": [
{
"module": "node:sqlite",
"var": "sqlite"
},
{
"module": "node:test",
"var": "test"
}
],
"x": 160,
"y": 120,
"wires": [[]]
}
]Environment
- Node-RED version: 5.0.8
- Node.js version: 24.19.0
- npm version: 11.17.0
- Platform/OS: Windows 11
- Browser: n/a (runtime/deploy-time issue, not editor-UI specific)
Activity
Steve-Mcl commentedon Oct 10, 2026
Happy to raise a PR - I suggest this would go against
mainas a bug fix (but could equally go againstdevas a feature)Let me know pls.
Steve-Mcl commentedon Oct 10, 2026
For when this gets picked up
Node-RED's Monaco integration (
@node-red/editor-client/.../monaco.js) has the samenode:prefix gap, just in a different place - theknownModulestable used to fetch type declarations for the Setup tab.sea.d.ts,sqlite.d.ts, andtest.d.tsonly declaredeclare module "node:sqlite"/"node:sea"/"node:test"- they dont have a bare alias!Example code I added to
editor-client/src/js/ui/editors/code-editors/monaco.js:100to test completionsSupport node:-prefixed core modules in parseModuleName