Resolve sentry-cli relative to @sentry/react-native in isolated dependency layouts #6241
Description
What React Native libraries do you use?
React Native / Expo, with pnpm workspace dependency layout
Are you using sentry.io or on-premise?
sentry.io (SaaS)
@sentry/react-native SDK Version
Observed with @sentry/react-native@7.11.0; current main still has the same direct resolver pattern in packages/core/sentry.gradle.kts and both iOS scripts.
Description
The Android Gradle integration and iOS Xcode scripts try to locate @sentry/cli with a direct Node resolution from the native project directory:
require.resolve('@sentry/cli/package.json')That does not work reliably with package managers that isolate dependencies, such as pnpm. @sentry/cli is installed as a dependency of @sentry/react-native, but it is not necessarily directly resolvable from android/ or ios/.
Resolving the CLI from the @sentry/react-native package context works in this layout:
require.resolve('@sentry/cli/package.json', {
paths: [require.resolve('@sentry/react-native/package.json')],
})Steps to Reproduce
- Use a pnpm workspace React Native app with
@sentry/react-nativeinstalled. - Do not install
@sentry/clias a direct app dependency. - Run the resolver from a native project directory such as
android/orios/:
node --print "require.resolve('@sentry/cli/package.json')"- Compare that with dependency-relative resolution:
node --print "require.resolve('@sentry/cli/package.json', { paths: [require.resolve('@sentry/react-native/package.json')] })"Expected Result
The native Android and iOS integrations should resolve the sentry-cli package shipped through @sentry/react-native without requiring applications to add @sentry/cli as a direct dependency or set a manual executable override.
Actual Result
Plain require.resolve('@sentry/cli/package.json') can fail with:
Error: Cannot find module '@sentry/cli/package.json'
Require stack:
- /path/to/app/android/[eval]
The dependency-relative resolver returns the installed pnpm store path for @sentry/cli, allowing the scripts to compute bin/sentry-cli correctly.
Proposed Fix
Use dependency-relative resolution in:
packages/core/sentry.gradle.ktspackages/core/scripts/sentry-xcode.shpackages/core/scripts/sentry-xcode-debug-files.sh
The existing pnpm shim fallback can stay in place as a fallback path.
Related
- Similar iOS symptom: PNPM iOS Upload Debug Symbol fail in EAS Build #6076
- Closed PR without issue reference: fix: resolve sentry-cli relative to react-native package #6240
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Jun 1, 2026
RN-662
shawnthye-guru commentedon Jun 1, 2026
I opened #6242 with the proposed resolver change so maintainers can review the concrete implementation. Happy to adjust the approach if there is a preferred helper or shared resolver pattern for these scripts.
shawnthye-guru commentedon Jun 1, 2026
The replacement PR was auto-closed because this issue does not yet have maintainer discussion. Could a maintainer confirm whether resolving
@sentry/clirelative to@sentry/react-nativeis an acceptable approach?The implementation is already prepared on branch
shawnthye-guru:fix/sentry-cli-resolution-6241; once the approach is acknowledged I can reopen or create a fresh PR according to the contribution guidelines.lucas-zimerman commentedon Jun 2, 2026
Thank you for opening this issue and describing the issue with rich details and also taking a chance to open a PR to fix it! we will take a look on the PR
github-actions commentedon Jun 11, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #6242, which was included in the 8.14.0 release.