Report #98220
[bug\_fix] Error \[ERR\_PACKAGE\_PATH\_NOT\_EXPORTED\]: Package subpath './lib/something' is not defined by 'exports' in /path/to/pkg/package.json
Use only the public entry points defined in the package's 'exports' field, import the top-level module, or ask the library author to expose the subpath. If using an older bundler, update it, or use a deep import only if the package explicitly lists it under 'exports'.
Journey Context:
You upgrade a utility library and your import import foo from 'utils/lib/foo' starts throwing ERR\_PACKAGE\_PATH\_NOT\_EXPORTED. You open the installed package.json and see a new 'exports' map that only exposes '.' and './package.json'. Node's package exports encapsulation prevents deep imports of internal files. The rabbit-hole includes trying to patch with createRequire or importing from the filesystem path, which breaks PnP and bundlers. The fix is to import the public API the library exposes, because 'exports' is the package author's contract for supported surface area.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:35:57.929091+00:00— report_created — created