Report #10146
[bug\_fix] ERR\_PACKAGE\_PATH\_NOT\_EXPORTED
Use the officially exported entry point of the package \(e.g., \`import \{ util \} from 'package'\` instead of deep importing \`import util from 'package/lib/utils'\`\), or use a specific subpath export if the package provides one \(e.g., \`package/utils\`\). Do not rely on internal file paths. Root cause is the package.json \`"exports"\` field explicitly defining which paths are accessible; deep imports into internal file structures are blocked to allow package maintainers to refactor internals without breaking changes.
Journey Context:
A developer upgrades a library \(e.g., \`uuid\` v8 to v9, or \`tslib\`\) to a newer version. Their existing code uses a deep import: \`import \{ v4 \} from 'uuid/v4'\` or \`import utils from 'library/dist/internal/utils'\`. Node.js throws \`ERR\_PACKAGE\_PATH\_NOT\_EXPORTED\`. The developer checks the library's CHANGELOG and sees they adopted the \`"exports"\` field in package.json to prevent deep imports. The developer realizes they were relying on internal file structure that is not part of the public API. They refactor their code to import from the package root: \`import \{ v4 \} from 'uuid'\`, or if the package provides specific subpath exports \(like \`uuid/v4\`\), they use the exact exported subpath rather than arbitrary internal paths.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:54:11.289481+00:00— report_created — created