cli icon indicating copy to clipboard operation
cli copied to clipboard

Builds failing with node v16.13.0 on arm64 mac m1

Open uloco opened this issue 4 years ago • 2 comments
trafficstars

Environment

System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
    Memory: 165.56 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - /var/folders/j5/ckgkc5b95wb6p5vhwt_h9dyr0000gn/T/fnm_multishells/59875_1637060404628/bin/node
    Yarn: Not Found
    npm: 8.1.3 - /var/folders/j5/ckgkc5b95wb6p5vhwt_h9dyr0000gn/T/fnm_multishells/59875_1637060404628/bin/npm
    Watchman: 2021.11.08.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.3
      System Images: android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7351085
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.66.3 => 0.66.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

Running the command react-native run-ios throws a lot of module map file not found errors. These are the same errors that happen when running xcode builds without rosetta enabled. I can successfully run the command with node version 15.0.6 for example. The difference between these two node versions is that the node 16 executable is native arm64. On node 15 I could just run the command without rosetta enabled in that terminal, which is pretty neat.

Reproducible Demo

Just use the standard template and try to run react-native run-ios with node 16.13.0

Output Error excerpt

...
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/MultiplatformBleAdapter/MultiplatformBleAdapter.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/ZIPFoundation/ZIPFoundation.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/iOSDFULibrary/iOSDFULibrary.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/lottie-ios/Lottie.modulemap' not found
<unknown>:0: error: module map file '/Users/uloco/Library/Developer/Xcode/DerivedData/Smokeless-cbzapohwsbunuofdtpzoyitfirjn/Build/Products/Debug-iphonesimulator/lottie-react-native/lottie_react_native.modulemap' not found
/Users/uloco/Source/smokeless/2/smokeless-react-native/ios/Pods/Target Support Files/Pods-Smokeless/ExpoModulesProvider.swift:8:8: error: no such module 'ExpoModulesCore'
import ExpoModulesCore
       ^


** BUILD FAILED **


The following build commands failed:
	CompileSwift normal x86_64 /Users/uloco/Source/smokeless/2/smokeless-react-native/ios/SwiftFile.swift (in target 'Smokeless' from project 'Smokeless')
	CompileSwift normal x86_64 /Users/uloco/Source/smokeless/2/smokeless-react-native/ios/Pods/Target\ Support\ Files/Pods-Smokeless/ExpoModulesProvider.swift (in target 'Smokeless' from project 'Smokeless')
	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'Smokeless' from project 'Smokeless')
(3 failures)

uloco avatar Nov 16 '21 12:11 uloco

I tried building this on a standard template of npx react-native init --template react-native-template-typescript and the build is running fine. I think the problem only occurs if you have any pod dependency that requires to be built with rosetta. But still the problem did not exist with node 15 and only happens when I switch to node 16. Do you have any idea why this happens and how I could possibly fix this? I am curious to what changed in node or react-native that could lead to this problem...

uloco avatar Nov 16 '21 15:11 uloco

@uloco I can create and build a vanilla RN app on M1/Monterey running Xcode 13.x, node 14.x, and RN 0.66. However, my existing app running the same xcode/node with RN 0.61.x does not. Both modules, lottie-ios and lottie-react-native throw errors. All my other pods are fine. So I'm not sure which combination of xcode/node/rn is the answer. If you find a solution, please share.

mjstelly avatar Feb 14 '22 19:02 mjstelly

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Nov 26 '22 03:11 github-actions[bot]