True when the error is a module-RESOLUTION failure (the module could not be found or
reached), as opposed to a module that was found but threw while loading — the latter is
a real error that must surface. ESM raises ERR_MODULE_NOT_FOUND, CommonJS resolution
(createRequire) raises MODULE_NOT_FOUND, and an exports-map mismatch raises
ERR_PACKAGE_PATH_NOT_EXPORTED. Some ESM loader shims (ts-node's, notably — the loader
MJAPI runs under) throw resolution failures as PLAIN Errors with no code at all, so
when there is no code, recognize Node's own resolver message instead.
⚠ Under ts-node's shim the coded branch never fires (the shim strips custom error
properties crossing the module-hooks thread), so the message branch is LOAD-BEARING
there: if a future Node rewords its resolver messages, this predicate must be updated
or the pnpm fallback silently stops working under ts-node hosts.
Keep in sync with IsModuleResolutionFailure in @memberjunction/open-app-engine's
src/install/migration-runner.ts — same heuristic, duplicated because the engine
cannot depend on this package and cross-package re-exports are disallowed.
True when the error is a module-RESOLUTION failure (the module could not be found or reached), as opposed to a module that was found but threw while loading — the latter is a real error that must surface. ESM raises ERR_MODULE_NOT_FOUND, CommonJS resolution (createRequire) raises MODULE_NOT_FOUND, and an exports-map mismatch raises ERR_PACKAGE_PATH_NOT_EXPORTED. Some ESM loader shims (ts-node's, notably — the loader MJAPI runs under) throw resolution failures as PLAIN Errors with no code at all, so when there is no code, recognize Node's own resolver message instead.
⚠ Under ts-node's shim the coded branch never fires (the shim strips custom error properties crossing the module-hooks thread), so the message branch is LOAD-BEARING there: if a future Node rewords its resolver messages, this predicate must be updated or the pnpm fallback silently stops working under ts-node hosts.
Keep in sync with
IsModuleResolutionFailurein @memberjunction/open-app-engine'ssrc/install/migration-runner.ts— same heuristic, duplicated because the engine cannot depend on this package and cross-package re-exports are disallowed.