diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index bcd1775bac898e..8fb3c96f8dc4c5 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -61,8 +61,12 @@ async function initCJSParse() { } else { const { parse, init } = require('internal/deps/cjs-module-lexer/dist/lexer'); - await init(); - cjsParse = parse; + try { + await init(); + cjsParse = parse; + } catch { + cjsParse = require('internal/deps/cjs-module-lexer/lexer').parse; + } } }