-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
[0.76] Error: Cannot find module '@react-native-community/cli-server-api' #47309
Open
Tracked by
#2131
Labels
0.76
Never gets stale
Prevent those issues and PRs from getting stale
p: Microsoft
Partner: Microsoft
Partner
Comments
|
|
33 tasks
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days. |
Facing this same issue when building my expo app in production mode using the EAS build command. |
tido64
added a commit
to tido64/react-native-template
that referenced
this issue
Feb 12, 2025
…/cli-server-api` See facebook/react-native#47309 for context.
3 tasks
facebook-github-bot
pushed a commit
that referenced
this issue
Feb 19, 2025
Summary: `react-native/community-cli-plugin` depends on `createDevServerMiddleware` from `react-native-community/cli-server-api`. `react-native/community-cli-plugin` currently [declares an optional peer dependency](https://github.com/facebook/react-native/blob/bae895500052bda2f55e1832b0c8a63a1b449de3/packages/community-cli-plugin/package.json#L39-L45) on `react-native-community/cli-server-api`, however because the latter isn't a dependency of `react-native` or the community template, the peer dependency is not available to package managers that enforce isolated node_modules - see #47309. Rather than add an unnecessary dependency to the template (like [this](react-native-community/template#105)), my proposal is to switch to a peer dependency on only `react-native-community/cli`, because that *is* a dependency of the community template and therefore will be resolvable. Because `react-native-community/cli` doesn't re-export `createDevServerMiddleware` from its dependency on `cli-server-api`, we need to resolve the latter through the former. This can be cleaned up once a re-export lands - react-native-community/cli#2605. Changelog: [GENERAL][FIXED] Fix registering of `start` and `bundle` commands with community CLI and isolated node_modules. Differential Revision: D69848688
facebook-github-bot
pushed a commit
that referenced
this issue
Feb 19, 2025
…li (#49518) Summary: Pull Request resolved: #49518 `react-native/community-cli-plugin` depends on `createDevServerMiddleware` from `react-native-community/cli-server-api`. `react-native/community-cli-plugin` currently [declares an optional peer dependency](https://github.com/facebook/react-native/blob/bae895500052bda2f55e1832b0c8a63a1b449de3/packages/community-cli-plugin/package.json#L39-L45) on `react-native-community/cli-server-api`, however because the latter isn't a dependency of `react-native` or the community template, the peer dependency is not available to package managers that enforce isolated node_modules - see #47309. Rather than add an unnecessary dependency to the template (like [this](react-native-community/template#105)), my proposal is to switch to a peer dependency on only `react-native-community/cli`, because that *is* a dependency of the community template and therefore will be resolvable. Because `react-native-community/cli` doesn't re-export `createDevServerMiddleware` from its dependency on `cli-server-api`, we need to resolve the latter through the former. This can be cleaned up once a re-export lands - react-native-community/cli#2605. Changelog: [GENERAL][FIXED] Fix registering of `start` and `bundle` commands with community CLI and isolated node_modules. Reviewed By: huntie Differential Revision: D69848688 fbshipit-source-id: 009b8ffd43b2ab2d84fcc71e9e48382eb8950bb1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
0.76
Never gets stale
Prevent those issues and PRs from getting stale
p: Microsoft
Partner: Microsoft
Partner
Description
react-native bundle
andreact-native start
are currently not correctly registered. After some investigation, this is what's happening:@react-native/community-cli-plugin
requires@react-native-community/cli-server-api
to register commands likebundle
andstart
react-native/packages/community-cli-plugin/package.json
Lines 36 to 41 in 3c02738
@react-native/community-cli-plugin
, which in this case isreact-native
. Butreact-native
does not declare dependency on@react-native-community/cli-server-api
. And since it's marked as optional, package managers don't complain.@react-native-community/cli-server-api
means thatbundle
andstart
never gets registered and won't show up in config.One way to fix this is to make
@react-native-community/cli-server-api
required again, and forward that dependency inreact-native
. This should make the consumer the responsible for satisfying the dependency. This also means that the template needs to be updated to include this dependency. I'm sure there are other alternatives that I have overlooked.An alternative to that would be to make
@react-native/community-cli-plugin
orreact-native
directly depend on@react-native/community-cli-plugin
.A third option would be to move the package to the RN repo and make it part of
@react-native/community-cli-plugin
Steps to reproduce
react-native
to 0.76 microsoft/rnx-kit#3409.yarnrc.yml
(thereact-native
section underresolutions
)yarn
packages/test-app/node_modules/
:@react-native-community/cli
not being found in monorepos #47304@react-native-community/cli-platform-*
packages not being found in monorepos #47308react-native config
insidepackages/test-app
bundle
andstart
are missingReact Native Version
0.76.1
Affected Platforms
Build - MacOS, Build - Windows, Build - Linux
Output of
npx react-native info
Stacktrace or Logs
Reproducer
microsoft/rnx-kit#3409
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: