Report #79840
[bug\_fix] Error \[ERR\_PACKAGE\_PATH\_NOT\_EXPORTED\]: Package subpath './lib/utils' is not defined by "exports"
Use a defined export path \(check the package's exports field\), or import from the main entry point. Do not rely on deep imports into package internals unless explicitly exported. Root cause: package.json 'exports' field explicitly maps available subpaths; importing undefined ones throws ERR\_PACKAGE\_PATH\_NOT\_EXPORTED.
Journey Context:
Developer upgrades a dependency \(e.g., lodash-es, uuid, or an internal library\) to a newer version. Their code does import utils from 'library/lib/internal'. Previously this worked because the library didn't use the 'exports' field. Now the library added 'exports' to enforce public API boundaries and security. Node.js throws ERR\_PACKAGE\_PATH\_NOT\_EXPORTED. Developer tries adding 'type': 'module', no effect. They check the dependency's package.json and see the 'exports' map only allows './utils' not './lib/utils'. They change their import to use the public export path or import from the main entry point, resolving the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:36:41.005179+00:00— report_created — created