[0.76] Error: Cannot find module '@react-native-community/cli-server-api' #47309
Labels
0.76
Needs: Author Feedback
Needs: Repro
This issue could be improved with a clear list of steps to reproduce the issue.
p: Microsoft
Partner: Microsoft
Partner
Description
@react-native/community-cli-plugin
currently has a peer dependency on@react-native-community/cli-server-api
AND marks it as optional, expecting whoever depends on it to resolve the dependency. In this case, it would bereact-native
, butreact-native
does not have a dependency on@react-native-community/cli-server-api
. Nor does it forward the dependency (i.e. declare peer dependency). In a monorepos (especially in pnpm setups), this will fail because@react-native-community/cli-server-api
does not get installed where@react-native/community-cli-plugin
can be expected to find it.When running
react-native config
, we get this error:The result is that neither
bundle
orstart
commands get registered.The correct way to fix this is to make
@react-native-community/cli-server-api
required again and forward the dependency inreact-native
. 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.Steps to reproduce
react-native
to 0.76 microsoft/rnx-kit#3409yarn
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: