Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with NODE_BINARY using spaces bundling iOS #48478

Closed
Namoku opened this issue Jan 3, 2025 · 2 comments
Closed

Problem with NODE_BINARY using spaces bundling iOS #48478

Namoku opened this issue Jan 3, 2025 · 2 comments

Comments

@Namoku
Copy link

Namoku commented Jan 3, 2025

Description

After migrate a project from 0.70 to 0.76.5 in Android works as expected, the problem is in iOS when I try to build from cli or xcode.
The main problem is in react-native-xcode.sh, if I bundle the code, the line 148 is set:
EXTRA_ARGS+=("--config-cmd" "$NODE_BINARY $NODE_ARGS $REACT_NATIVE_DIR/cli.js config")
but the NODE_BINARY here is placing without escape characters so the bundle script fails.

In the stacktrace below you can see it's not having problem executing node using the PATH with spaces, the problem is the bundle.js taking the PATH.

As a temp solution I solved just placing $NODE_BINARY between ', but I think it's a problem in the script itself.

Steps to reproduce

yarn start
yarn run ios

React Native Version

0.76.5

Affected Platforms

Build - MacOS

Output of npx react-native info

System:
  OS: macOS 15.1.1
  CPU: (8) arm64 Apple M1
  Memory: 212.53 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.7.0
    path: ~/Library/Caches/fnm_multishells/6447_1735929669740/bin/node
  Yarn:
    version: 3.6.4
    path: ~/Library/Caches/fnm_multishells/6447_1735929669740/bin/yarn
  npm:
    version: 10.8.2
    path: ~/Library/Caches/fnm_multishells/6447_1735929669740/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/nando/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /Users/nando/.rbenv/shims/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: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Node found at: /Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node
+ DEST='/Users/nando/Library/Developer/Xcode/DerivedData/SampleApp-advztwdmhwppmzbuvdlbkperljko/Build/Products/QA Debug-iphoneos/SampleApp.app'
+ [[ ! -n '' ]]
+ [[ QA Debug = *Debug* ]]
+ [[ ! iphoneos == *simulator ]]
+ for num in 0 1 2 3 4 5 6 7 8
++ ipconfig getifaddr en0
+ IP=192.168.3.216
+ '[' '!' -z 192.168.3.216 ']'
+ break
+ '[' -z 192.168.3.216 ']'
+ echo 192.168.3.216
+ [[ -n '' ]]
+ case "$CONFIGURATION" in
+ [[ iphoneos == *simulator ]]
+ echo 'Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior.'
Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior.
+ DEV=true
+++ dirname ../node_modules/react-native/scripts/react-native-xcode.sh
++ cd ../node_modules/react-native/scripts/..
++ pwd
+ REACT_NATIVE_DIR=/Users/nando/Developer/a/test/node_modules/react-native
+ PROJECT_ROOT=/Users/nando/Developer/a/test/ios/..
+ cd /Users/nando/Developer/a/test/ios/..
+ [[ -n '' ]]
+ [[ -s index.ios.js ]]
+ ENTRY_FILE=index.js
+ source /Users/nando/Developer/a/test/node_modules/react-native/scripts/node-binary.sh
++ '[' -z '/Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node' ']'
++ type '/Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node'
+ HERMES_ENGINE_PATH=/Users/nando/Developer/a/test/ios/Pods/hermes-engine
+ '[' -z '' ']'
+ HERMES_CLI_PATH=/Users/nando/Developer/a/test/ios/Pods/hermes-engine/destroot/bin/hermesc
+ [[ true != false ]]
+ [[ -f /Users/nando/Developer/a/test/ios/Pods/hermes-engine ]]
+ '[' -z '' ']'
+ export NODE_ARGS=
+ NODE_ARGS=
+ '[' -z '' ']'
+ CLI_PATH=/Users/nando/Developer/a/test/node_modules/react-native/scripts/bundle.js
+ '[' -z '' ']'
+ BUNDLE_COMMAND=bundle
+ '[' -z '' ']'
+ COMPOSE_SOURCEMAP_PATH=/Users/nando/Developer/a/test/node_modules/react-native/scripts/compose-source-maps.js
+ [[ -z '' ]]
+ CONFIG_ARG=
+ BUNDLE_FILE='/Users/nando/Library/Developer/Xcode/DerivedData/SampleApp-advztwdmhwppmzbuvdlbkperljko/Build/Products/QA Debug-iphoneos/main.jsbundle'
+ EXTRA_ARGS=()
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ '[' '' = YES ']'
+ EMIT_SOURCEMAP=
+ [[ ! -z '' ]]
+ PACKAGER_SOURCEMAP_FILE=
+ [[ '' == true ]]
+ [[ true != false ]]
+ [[ true == false ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ EXTRA_ARGS+=("--config-cmd" "$NODE_BINARY $NODE_ARGS $REACT_NATIVE_DIR/cli.js config")
+ '/Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node' /Users/nando/Developer/a/test/node_modules/react-native/scripts/bundle.js bundle --entry-file index.js --platform ios --dev true --reset-cache --bundle-output '/Users/nando/Library/Developer/Xcode/DerivedData/SampleApp-advztwdmhwppmzbuvdlbkperljko/Build/Products/QA Debug-iphoneos/main.jsbundle' --assets-dest '/Users/nando/Library/Developer/Xcode/DerivedData/SampleApp-advztwdmhwppmzbuvdlbkperljko/Build/Products/QA Debug-iphoneos/SampleApp.app' --config-cmd '/Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node  /Users/nando/Developer/a/test/node_modules/react-native/cli.js config'
/bin/sh: /Users/nando/Library/Application: No such file or directory
(node:78569) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: /Users/nando/Library/Application Support/fnm/node-versions/v22.7.0/installation/bin/node  /Users/nando/Developer/a/test/node_modules/react-native/cli.js config
/bin/sh: /Users/nando/Library/Application: No such file or directory

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at Command.handleAction (/Users/nando/Developer/a/test/node_modules/react-native/scripts/bundle.js:48:9)
    at Command.listener [as _actionHandler] (/Users/nando/Developer/a/test/node_modules/react-native/node_modules/commander/lib/command.js:542:17)
    at /Users/nando/Developer/a/test/node_modules/react-native/node_modules/commander/lib/command.js:1502:14
    at Command._chainOrCall (/Users/nando/Developer/a/test/node_modules/react-native/node_modules/commander/lib/command.js:1386:12)
    at Command._parseCommand (/Users/nando/Developer/a/test/node_modules/react-native/node_modules/commander/lib/command.js:1501:27)
    at Command.parse (/Users/nando/Developer/a/test/node_modules/react-native/node_modules/commander/lib/command.js:1064:10) {
  status: 127,
  signal: null,
  output: [
    null,
    '',
    '/bin/sh: /Users/nando/Library/Application: No such file or directory\n'
  ],
  pid: 78611,
  stdout: '',
  stderr: '/bin/sh: /Users/nando/Library/Application: No such file or directory\n'
}

Node.js v22.7.0

Reproducer

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: iOS iOS applications. 📦Bundler labels Jan 3, 2025
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@sbuggay
Copy link
Contributor

sbuggay commented Jan 4, 2025

Looks to be an issue with fnm's default install location containing a space. Resolved in #48275.

@sbuggay sbuggay closed this as completed Jan 4, 2025
@sbuggay sbuggay added Resolution: Duplicate and removed Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants