diff --git a/packages/node_modules/@node-red/registry/lib/externalModules.js b/packages/node_modules/@node-red/registry/lib/externalModules.js index 470d09a29..ca1e4bfd8 100644 --- a/packages/node_modules/@node-red/registry/lib/externalModules.js +++ b/packages/node_modules/@node-red/registry/lib/externalModules.js @@ -10,6 +10,7 @@ const clone = require("clone"); const exec = require("@node-red/util").exec; const log = require("@node-red/util").log; const hooks = require("@node-red/util").hooks; +const url = require("url"); const BUILTIN_MODULES = require('module').builtinModules; @@ -139,7 +140,8 @@ function importModule(module) { const externalModuleDir = getInstallDir(); const moduleDir = path.join(externalModuleDir,"node_modules",module); // Import needs the full path to the module's main .js file - const moduleFile = require.resolve(moduleDir); + // It also needs to be a file:// url for Windows + const moduleFile = url.pathToFileURL(require.resolve(moduleDir)); return import(moduleFile); }