react / react/react-native

Spaces in folder name breaks iOS build

Đang mở
#54,167 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Platform: iOS Resolution: PR Submitted
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

Noticed this change while investigating #54140, but having a space in your folder name still results in a broken build (at least with the default XCode build phases).

A fix that seems to work for me is changing the "Bundle React code" build phase to include extra quotes to double wrap the file paths like so:

set -e

WITH_ENVIRONMENT="\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\""
REACT_NATIVE_XCODE="\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\""

/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
Steps to reproduce
  1. Clone the repo, yarn, pod install.
  2. Change the directory name to one with spaces (e.g. mv repo "space bug")
  3. Optionally add set -x to the "Bundle React Native code and images" build phase to view the shell commands executed.
  4. Attempt to build the xcode workspace.
React Native Version

0.82.0

Affected Platforms

Build - MacOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 220.09 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.17.1
    path: /Users/davidliu/.nvm/versions/node/v22.17.1/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: /Users/davidliu/.nvm/versions/node/v22.17.1/bin/npm
  Watchman:
    version: 2025.02.17.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/davidliu/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "24"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 27.0.3
      - 28.0.3
      - 29.0.0
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
      - 35.0.0
      - 35.0.0
      - 36.0.0
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2512.13840223
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /opt/homebrew/opt/sdkman-cli/libexec/candidates/java/current/bin/javac
  Ruby:
    version: 3.3.5
    path: /Users/davidliu/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.82.0
    wanted: 0.82.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
+ WITH_ENVIRONMENT='/Users/davidliu/github/space bug/ReproducerApp/ios/Pods/../../node_modules/react-native/scripts/xcode/with-environment.sh'
+ REACT_NATIVE_XCODE='/Users/davidliu/github/space bug/ReproducerApp/ios/Pods/../../node_modules/react-native/scripts/react-native-xcode.sh'
+ /bin/sh -c '/Users/davidliu/github/space bug/ReproducerApp/ios/Pods/../../node_modules/react-native/scripts/xcode/with-environment.sh /Users/davidliu/github/space bug/ReproducerApp/ios/Pods/../../node_modules/react-native/scripts/react-native-xcode.sh'
/bin/sh: /Users/davidliu/github/space: No such file or directory
MANDATORY Reproducer

https://github.com/davidliu/react-native-space-bug

Screenshots and Videos

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với build phase Bundle React code and images và các entry point scripts/xcode/with-environment.sh và scripts/react-native-xcode.sh được hiển thị trong log. Tái hiện build sau khi di chuyển repository vào một path có chứa khoảng trắng, sau đó xác minh rằng Xcode workspace build thành công từ path đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, react-native, shell
Lĩnh vực
build-system, mobile
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.