Report #5783
[bug\_fix] ERR\_PACKAGE\_PATH\_NOT\_EXPORTED Package subpath not defined
Use only subpaths explicitly listed in the package's \`exports\` field in package.json, or import from the main entry point if the subpath is not exported. If you control the dependency, add the subpath to the \`exports\` map. Root cause is that Node.js 12.7\+ enforces the \`exports\` field as an allowlist; deep imports into package internals that are not explicitly exported are blocked to prevent reliance on internal file structures that may change.
Journey Context:
You upgrade a dependency \(e.g., \`uuid\`, \`lodash\`, or a UI library\) and your code does \`import something from 'library/dist/something'\`. Immediately get \`Error \[ERR\_PACKAGE\_PATH\_NOT\_EXPORTED\]: Package subpath './dist/something' is not defined by "exports" in .../node\_modules/library/package.json\`. You inspect that package.json and see an \`exports\` field that only maps specific paths like "." and "./package.json". You realize the package author intentionally blocked deep imports to refactor internals. You change your import to use the main entry point or a named export, or pin the package to the version before exports were added.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T22:11:55.005653+00:00— report_created — created