Skip to content

Commit 6a7b013

Browse files
fix(ci): enable Corepack for React Native SDK (needs yarn@3.6.1)
The RN SDK declares `packageManager: "yarn@3.6.1"` in package.json, which requires Corepack rather than the OS-installed Yarn 1.22. Previous CI run fell through to Yarn 1.22 and failed: error This project's package.json defines "packageManager": "yarn@3.6.1". However the current global version of Yarn is 1.22.22. Fix: - pr-build.yml sdk_react_native: `corepack enable` before install; prefer `yarn install --immutable` when the project declares yarn via packageManager. - package-sdk.sh (RN): same corepack-enable + yarn-preferred logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d55ce4a commit 6a7b013

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,18 @@ jobs:
397397
- uses: ./.github/actions/setup-toolchain
398398
with:
399399
platform: sdk-only
400+
- name: Enable Corepack (for yarn@3.6.1 declared in packageManager)
401+
run: corepack enable
400402
- name: Install RN workspace
401403
working-directory: sdk/runanywhere-react-native
402-
run: npm install --legacy-peer-deps || yarn install
404+
run: |
405+
# The RN SDK uses yarn workspaces + yarn@3.6.1 via Corepack; fall
406+
# back to npm install only as a last resort for older checkouts.
407+
if [ -f yarn.lock ] || grep -q '"packageManager": "yarn@' package.json 2>/dev/null; then
408+
yarn install --immutable || yarn install
409+
else
410+
npm install --legacy-peer-deps
411+
fi
403412
- name: Typecheck packages
404413
working-directory: sdk/runanywhere-react-native
405414
run: |

sdk/runanywhere-react-native/scripts/package-sdk.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,18 @@ fi
6060

6161
cd "$RN_ROOT"
6262

63-
# Prefer yarn if a lockfile exists; fall back to npm.
63+
# The RN SDK declares `packageManager: "yarn@3.6.1"`, so it requires Corepack
64+
# (not the OS-level Yarn 1.x). Enable Corepack and use yarn; fall back to npm
65+
# only when yarn is genuinely unavailable.
66+
if grep -q '"packageManager": "yarn@' package.json 2>/dev/null; then
67+
if command -v corepack >/dev/null 2>&1; then
68+
corepack enable >/dev/null 2>&1 || true
69+
fi
70+
fi
71+
6472
if [ -f "yarn.lock" ] && command -v yarn >/dev/null 2>&1; then
6573
echo ">> yarn install"
66-
yarn install
74+
yarn install --immutable 2>/dev/null || yarn install
6775
HAS_YARN=1
6876
else
6977
echo ">> npm install --legacy-peer-deps"

0 commit comments

Comments
 (0)