diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 81bc4b8d81ffe9..cb05bc43872d03 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1434,8 +1434,8 @@ E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => { let msg = 'Only file and data URLs are supported by the default ESM loader'; if (isWindows && url.protocol.length === 2) { - msg += '. Absolute Windows paths without prefix are not valid URLs, ' + - "consider using 'file://' prefix"; + msg += + '. On Windows, absolute paths must be valid file:// URLs'; } msg += `. Received protocol '${url.protocol}'`; return msg; diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 30a5758ad9b0d4..0cb56dff2c04c5 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -59,8 +59,8 @@ function expectFsNamespace(result) { if (common.isWindows) { const msg = 'Only file and data URLs are supported by the default ESM loader. ' + - 'Absolute Windows paths without prefix are not valid URLs, ' + - "consider using 'file://' prefix. Received protocol 'c:'"; + 'On Windows, absolute paths must be valid file:// URLs. ' + + "Received protocol 'c:'"; expectModuleError(import('C:\\example\\foo.mjs'), 'ERR_UNSUPPORTED_ESM_URL_SCHEME', msg);