Skip to content

node v17.0.1 react@next [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" #16623

Closed as not planned
facebook/react
#22954

Description

Similar to #16180 there is a problem with react@next a.k.a. (react@18.0.0-alpha-...), where the "exports" field was added to the package.json.

Storybook tries to resolve react/package.json in lib/ui, builder-webpack5 and builder-webpack4

node v12.22.7 is fine.
node v14.18.1 is fine.
node v16.13.0 succeed with a warning.

node16 --eval 'require.resolve("react/package.json")'
(node:624999) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at ...

node v17.0.1 throws an error.

node17 --eval 'require.resolve("react/package.json")'
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in  ...

A possible solution for this specific react/package.json problem could be to just resolve the pkg name as in react instead of react/package.json.

node17 --eval 'require.resolve("react")'
// no error

Allthough this still might be broken should react choose to export a different subdirectory as its main entry.

Further context is available at nodejs/node#33460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions