Skip to content

iOS: pod install keeps an ios/.xcode.env.local whose node was removed, so every build fails after a node upgrade #59538

Open

Description

@YevheniiKotyrlo

Description

pod install writes ios/.xcode.env.local with the absolute path of the node it runs under, and only when the file is missing. Every Xcode script phase sources it after .xcode.env, so its pinned path wins over .xcode.env's $(command -v node). A node version manager that removes the version the file names (nvm installs a newer node and uninstalls the old one) leaves the project pointing at a binary that no longer exists, and neither another pod install nor a rebuild repairs it: the first script phase that runs node fails.

create_xcode_env_if_missing (scripts/cocoapods/utils.rb) writes the file inside if !file_manager.exist?("#{file_path}.local") and never reads it back, and scripts/xcode/with-environment.sh sources .xcode.env, then .xcode.env.local when present. #51466 reported this on 0.76.9 and was closed as completed; its last comment reports it again on 0.82.

Steps to reproduce

On macOS with nvm, using the reproducer (the template app, unchanged):

  1. nvm install 24.18 && nvm use 24.18, then cd ReproducerApp && yarn install && cd ios && pod install. ios/.xcode.env.local reads export NODE_BINARY=/Users/<you>/.nvm/versions/node/v24.18.1/bin/node.
  2. nvm use default && nvm uninstall 24.18.1.
  3. pod install again. ios/.xcode.env.local is unchanged.
  4. cd .. && xcodebuild -workspace ios/ReproducerApp.xcworkspace -scheme ReproducerApp -configuration Release -sdk iphoneos -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO build.

Expected: the build uses the node that runs it. Seen: ** BUILD FAILED ** with exit status 65, in the [CP-User] [Hermes] Replace Hermes for the right configuration, if needed and [CP-User] [RNDeps] Replace React Native Dependencies for the right configuration, if needed script phases.

React Native Version

0.88.0

Affected Platforms

Runtime - iOS, Build - MacOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 27.0.1
  CPU: (8) arm64 Apple M1
  Memory: 97.73 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 26.12.1
    path: /Users/yevhenii/.nvm/versions/node/v26.12.1/bin/node
  Yarn: Not Found
  npm:
    version: 12.2.1
    path: /Users/yevhenii/.nvm/versions/node/v26.12.1/bin/npm
  Watchman:
    version: 2026.10.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.17.0
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 27.0
      - iOS 27.1
      - macOS 27.0
      - tvOS 27.0
      - visionOS 27.0
      - watchOS 27.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 27.1/27A9275
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 4.0.9
    path: /opt/homebrew/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Run outside the project, so it finds no npm packages; the reproducer runs react-native 0.88.0 with @react-native-community/cli 20.2.0.

Stacktrace or Logs

== ios/.xcode.env.local after the first pod install:
export NODE_BINARY=/Users/yevhenii/.nvm/versions/node/v24.18.1/bin/node
== node after removing v24.18.1: /Users/yevhenii/.nvm/versions/node/v26.12.1/bin/node v26.12.1
== ios/.xcode.env.local after pod install again:
export NODE_BINARY=/Users/yevhenii/.nvm/versions/node/v24.18.1/bin/node
== xcodebuild exit status: 65
.../hermes-engine.build/Script-46EB2E00011B30.sh: line 9: /Users/yevhenii/.nvm/versions/node/v24.18.1/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
.../ReactNativeDependencies.build/Script-46EB2E00011B10.sh: line 9: /Users/yevhenii/.nvm/versions/node/v24.18.1/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/rn-ios-xcode-env-local-removed-node

Screenshots and Videos

The log above is the whole failure.

Activity

  1. dave-otf commented on Oct 27, 2026

    @dave-otf

    Nice report—the stale path is consistent with the current generator: create_xcode_env_if_missing only creates .xcode.env.local when absent, and the Xcode wrapper sources that local file after .xcode.env (generator, wrapper). For an immediate unblock, with the desired Node version active, remove or update only ios/.xcode.env.local, rerun pod install, then rebuild; deleting Pods/ alone will not refresh this project-level file. A regression case could start with .xcode.env.local pointing to a missing NODE_BINARY, run pod install under a working Node, and verify it refreshes to node --print process.argv[0].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions