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

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

Closed
calbrecht opened this issue Nov 6, 2021 · 4 comments · Fixed by facebook/react#22954

Comments

@calbrecht
Copy link

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

@Jack-Works
Copy link

Hi this need to be fixed because it's no longer a warning but an fatal error in Node 17

@stale
Copy link

stale bot commented Jan 9, 2022

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 9, 2022
@laurenthiernard
Copy link

laurenthiernard commented Jan 14, 2022

still happening, I'm running the demo project https://storybook.js.org/tutorials/intro-to-storybook/react/en/get-started/
node v17.3.0
Edit: just seen it might be fixed on next RC

@stale stale bot removed the inactive label Jan 14, 2022
thiagojedi added a commit to thiagojedi/compat-alias-package that referenced this issue Oct 4, 2022
So, there were a few issues with Node >17 and storybookjs (storybookjs/storybook#16623) that was causing errors on build, similarly to preactjs/preact#3745.

It was fixed in the same way by react: facebook/react#22954
@shilman
Copy link
Member

shilman commented Jun 8, 2023

We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:

@shilman shilman closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants