Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package subpath './lib' is not defined by "exports" #39

Closed
aplr opened this issue Sep 15, 2022 · 3 comments
Closed

Package subpath './lib' is not defined by "exports" #39

aplr opened this issue Sep 15, 2022 · 3 comments

Comments

@aplr
Copy link

aplr commented Sep 15, 2022

I just ran npm update, which updated headers-polyfill to the just released 3.1.0, which modifies the exports in package.json. This is the error I get:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /myapp/node_modules/headers-polyfill/package.json
    at new NodeError (node:internal/errors:387:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:464:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:748:3)
    at resolveExports (node:internal/modules/cjs/loader:493:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/myapp/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js:89:13) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
@aplr aplr closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2022
@jtoar
Copy link

jtoar commented Sep 15, 2022

I work on RedwoodJS and our CI just ran into the same thing: https://github.com/redwoodjs/redwood/actions/runs/3059432181/jobs/4936841173#step:8:1264

We use MSW in the context of Storybook so the stack trace is a bit different, but the initial error is the same:

ModuleNotFoundError: Module not found: Error: Package path ./lib is not exported from package /Users/dom/prjcts/smoke-test-debug/node_modules/headers-polyfill (see exports field in /Users/dom/prjcts/smoke-test-debug/node_modules/headers-polyfill/package.json)
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/Compilation.js:2016:28
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/Users/dom/prjcts/smoke-test-debug/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/Users/dom/prjcts/smoke-test-debug/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /Users/dom/prjcts/smoke-test-debug/node_modules/webpack/lib/NormalModuleFactory.js:975:5

Downgrading to 3.0.10 fixes it.

@aplr
Copy link
Author

aplr commented Sep 15, 2022

It's an issue within mswjs/interceptors, therefore I've moved the issue to mswjs/interceptors#285

@kettanaito
Copy link
Member

Thanks for reporting this. I've opened a fix at mswjs/interceptors#286. Will publish today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants