Skip to content

Commit a299f14

Browse files
gronxbatlj
andauthored
fix: spawn CLI directly without using Node (#689)
<!-- Please provide enough information so that others can review your pull request. --> <!-- Keep pull requests small and focused on a single change. --> ### Summary ![image](https://github.com/user-attachments/assets/2880ad03-3d96-4056-bbdf-299c34aba724) The default is set to `yarn`, but an error occurs when using `pnpm` to run `bob build`. The error arises because the CLI is spawned via Node. Since the CLI in `.bin` is designed to run with Node by default, it should spawn correctly even without explicitly prepending node. <!-- What existing problem does the pull request solve? Can you solve the issue with a different approach? --> ### Test plan > The changes work correctly even when tested with Yarn. 1. Create a repository using the command: ```sh > npx create-react-native-library@latest rn-lib ``` 3. Remove the `packageManager` field from the `package.json`. 4. Run `pnpm install` * as-is 5. An error occurs. * to-be 5. Success. <!-- List the steps with which we can test this change. Provide screenshots if this changes anything visual. --> --------- Co-authored-by: Burak Güner <[email protected]>
1 parent 941e35c commit a299f14

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/react-native-builder-bob/src/utils/runRNCCli.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import path from 'node:path';
44
import fs from 'fs-extra';
55
import assert from 'node:assert';
66

7-
// This is a special case for calling bob from the XCode scripts
8-
// XCode scripts don't have the node binary properly set
9-
// We expose an env value for node instead.
10-
const NODE_BINARY = process.env['NODE_BINARY'] || 'node';
7+
const NODE_BINARY = 'node';
118

129
/**
1310
* Runs the React Native Community CLI with the specified arguments
@@ -27,7 +24,7 @@ export async function runRNCCli(
2724
rncCliBinaryName
2825
);
2926

30-
return await spawn(NODE_BINARY, [RNC_CLI_BINARY_PATH, ...args], options);
27+
return await spawn(RNC_CLI_BINARY_PATH, args, options);
3128
}
3229

3330
async function getCliBinaryName(): Promise<string> {

0 commit comments

Comments
 (0)