run-ios --buildFolder installs the app from the default DerivedData instead of the build folder
Mantenedores costumam responder em até 2 dias
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- react-native, typescript
- Domínio
- cli, mobile-dev
Direção de pesquisa
Start with packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts and packages/cli-platform-apple/src/commands/runCommand/getBuildSettings.ts, then trace how runOnSimulator.ts, runOnDevice.ts and createRun.ts pass build options. Check how -showBuildSettings resolves TARGET_BUILD_DIR when --buildFolder is set. Done means the run paths install or open the app from that build folder; the issue names no tests.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Environment
System:
OS: macOS 27.0.1
Binaries:
Node: 24.18.0
pnpm: 11
IDEs:
Xcode: 27.0/27A266a
npmPackages:
"@react-native-community/cli-platform-apple": 20.2.0
react-native: 0.85
The bug does not depend on the Xcode version; the relevant code is unchanged on main (21.0.0-alpha.1).
Description
run-ios --buildFolder <dir> builds into <dir> but installs the app from Xcode's default DerivedData.
buildProject passes the folder to the build as -derivedDataPath <dir>. After the build, installApp resolves the app through getBuildSettings, which runs xcodebuild … -showBuildSettings -json without -derivedDataPath. TARGET_BUILD_DIR therefore points into ~/Library/Developer/Xcode/DerivedData/<Project>-<hash>/… and not into <dir>. As a result:
-
If the default DerivedData holds an older build of the project (for example from an Xcode IDE build), the CLI installs and launches that stale
.appwithout any warning. -
If it holds no build, the command fails after
success Successfully built the app:UnhandledPromiseRejection: … The promise rejected with the reason "Error: target build directory /Users/…/Library/Developer/Xcode/DerivedData/<Project>-<hash>/Build/Products/Debug-iphonesimulator does not exist".
The same applies to runOnDevice (physical device and Mac Catalyst) and to openApp (macOS), because they all go through getBuildSettings.
--binary-path does not work around this: it skips the build and passes buildOutput: '', so getBuildSettings throws on getPlatformName('') (#2517).
Code references on main:
packages/cli-platform-apple/src/commands/buildCommand/buildProject.tsadds-derivedDataPathfromargs.buildFolder.packages/cli-platform-apple/src/commands/runCommand/getBuildSettings.tsbuilds the-showBuildSettingscall without it.runOnSimulator.ts,runOnDevice.tsandcreateRun.ts(macOS) do not passargs.buildFoldertoinstallApp/openApp/getBuildSettings.
Related: createRun calls process.chdir(sourceDir) (the ios/ directory) before building, so a relative --buildFolder resolves against ios/ and not the project root. The option description does not say which directory it is relative to.
Proposed fix: thread buildFolder from the run paths into getBuildSettings and append -derivedDataPath <buildFolder> to the -showBuildSettings call when it is set. I applied this as a local patch on 20.2.0: run-ios --buildFolder build/DerivedData then installs and launches the freshly built app from ios/build/DerivedData/Build/Products/Debug-iphonesimulator/. PR to follow.
Reproducible Demo
- In any React Native project, make sure the default DerivedData has no build for it:
rm -rf ~/Library/Developer/Xcode/DerivedData/<Project>-*. - Run
npx react-native run-ios --buildFolder build/DerivedData. - The build succeeds into
ios/build/DerivedData, then the CLI fails withtarget build directory …/Library/Developer/Xcode/DerivedData/<Project>-<hash>/Build/Products/Debug-iphonesimulator does not exist.
Expected: the CLI installs and launches the app it just built in ios/build/DerivedData.
- Linguagem predominante
- TypeScript
- Estrelas
- 2.9k
- Forks
- 948
- Merge médio
- 10d 19h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de react-native-community/cli
-
run-ios --udid <physical device> throws "No simulator available" because the fallback simulator is resolved eagerlyTalvez já em andamento @huytdps13400 assumiu há 41 dias. Abertabug report
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
react-native-community/cli#2826 ·
Mantenedores costumam responder em até 2 dias
-
`project.ios.automaticPodsInstallation` default of `true` never applies unless `project.ios` is explicitly declared in `react-native.config.js`Talvez já em andamento @huytdps13400 assumiu há 41 dias. Abertabug report
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
react-native-community/cli#2825 ·
Mantenedores costumam responder em até 2 dias
-
run-ios: "Unable to boot device in current state: Booted" alert when the simulator is already bootedTalvez já em andamento @bryandent assumiu há 85 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
react-native-community/cli#2820 ·
Mantenedores costumam responder em até 2 dias
-
run-ios on Xcode 27: DeviceHub opens no window when the simulator is shut downTalvez já em andamento @rakodev assumiu há 2 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
react-native-community/cli#2866 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
Tons of errors are ignoredAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
react-native-community/cli#2852 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de react-native-community/cli
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
wardian-app/Wardian#1603 ·
Mantenedores costumam responder em até 1 dia
-
Sign the pledgeAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
input-output-hk/devx-updates#168 ·
Mantenedores costumam responder em até 1 dia
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
github/docs#46222 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
agent-ready area: config area: skills type: chore upstream: brain-kit
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 95/100
-
dev experience frontend good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
cuttle-cards/cuttle#1403 ·
Mantenedores costumam responder em até 1 dia