We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bbb657 commit dc9f175Copy full SHA for dc9f175
lib/internal/modules/run_main.js
@@ -2,8 +2,8 @@
2
3
const {
4
ObjectGetPrototypeOf,
5
- SyntaxErrorPrototype,
6
StringPrototypeEndsWith,
+ SyntaxErrorPrototype,
7
globalThis,
8
} = primordials;
9
@@ -174,7 +174,7 @@ function executeUserEntryPoint(main = process.argv[1]) {
174
// Module._load is the monkey-patchable CJS module loader.
175
Module._load(main, null, true);
176
} catch (error) {
177
- if (ObjectGetPrototypeOf(error) === SyntaxErrorPrototype) {
+ if (error != null && ObjectGetPrototypeOf(error) === SyntaxErrorPrototype) {
178
const { shouldRetryAsESM } = internalBinding('contextify');
179
const mainPath = resolvedMain || main;
180
mainURL = pathToFileURL(mainPath).href;
0 commit comments