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

RN 0.73.x fails to compile once Nodejs-mobile is added to project #62

Open
eightlines opened this issue Dec 14, 2023 · 3 comments
Open
Labels
document Improvements or additions to documentation .should

Comments

@eightlines
Copy link

Trying to deploy a RN app to iOS. If I build a bare-bones RN app I can get this running in a simulator without issue. The moment I add nodejs-mobile the application no longer compiles.

Versions:
NodeJS 21.2.0 (I have also tried with Node 18.17)
RN 0.73.0
nodejs-mobile 18.17.4
iOS Simulator 17.2
Intel Mac running macOS 14

Install Process

npx react-native init projectName
cd projectName
npm start > i (Install cocoapods)
(Confirm the installation operates on iOS Simulator, exit Metro server)
npm i nodejs-mobile-react-native
cd ios
pod install
cd ..
npm start > i (build new iOS app, hangs, build logs below)

Build process:

ComputeTargetDependencyGraph
note: Building targets in dependency order
note: Target dependency graph (65 targets)
    Target 'MWBuild8' in project 'MWBuild8'
        ➜ Implicit dependency on target 'Pods-MWBuild8' in project 'Pods' via file 'libPods-MWBuild8.a' in build phase 'Link Binary'
        ➜ Implicit dependency on target 'CocoaAsyncSocket' in project 'Pods' via options '-lCocoaAsyncSocket' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'DoubleConversion' in project 'Pods' via options '-lDoubleConversion' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Flipper' in project 'Pods' via options '-lFlipper' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Flipper-Boost-iOSX' in project 'Pods' via options '-lFlipper-Boost-iOSX' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Flipper-Fmt' in project 'Pods' via options '-lFlipper-Fmt' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Flipper-Folly' in project 'Pods' via options '-lFlipper-Folly' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Flipper-PeerTalk' in project 'Pods' via options '-lFlipper-PeerTalk' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'FlipperKit' in project 'Pods' via options '-lFlipperKit' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'RCT-Folly' in project 'Pods' via options '-lRCT-Folly' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'RCTTypeSafety' in project 'Pods' via options '-lRCTTypeSafety' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-Codegen' in project 'Pods' via options '-lReact-Codegen' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-Core' in project 'Pods' via options '-lReact-Core' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-CoreModules' in project 'Pods' via options '-lReact-CoreModules' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-Fabric' in project 'Pods' via options '-lReact-Fabric' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-FabricImage' in project 'Pods' via options '-lReact-FabricImage' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-ImageManager' in project 'Pods' via options '-lReact-ImageManager' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-Mapbuffer' in project 'Pods' via options '-lReact-Mapbuffer' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-NativeModulesApple' in project 'Pods' via options '-lReact-NativeModulesApple' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTAnimation' in project 'Pods' via options '-lReact-RCTAnimation' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTAppDelegate' in project 'Pods' via options '-lReact-RCTAppDelegate' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTBlob' in project 'Pods' via options '-lReact-RCTBlob' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTFabric' in project 'Pods' via options '-lReact-RCTFabric' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTImage' in project 'Pods' via options '-lReact-RCTImage' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTLinking' in project 'Pods' via options '-lReact-RCTLinking' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTNetwork' in project 'Pods' via options '-lReact-RCTNetwork' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTSettings' in project 'Pods' via options '-lReact-RCTSettings' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTText' in project 'Pods' via options '-lReact-RCTText' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-RCTVibration' in project 'Pods' via options '-lReact-RCTVibration' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-cxxreact' in project 'Pods' via options '-lReact-cxxreact' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-debug' in project 'Pods' via options '-lReact-debug' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-graphics' in project 'Pods' via options '-lReact-graphics' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-hermes' in project 'Pods' via options '-lReact-hermes' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-jserrorhandler' in project 'Pods' via options '-lReact-jserrorhandler' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-jsi' in project 'Pods' via options '-lReact-jsi' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-jsiexecutor' in project 'Pods' via options '-lReact-jsiexecutor' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-jsinspector' in project 'Pods' via options '-lReact-jsinspector' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-logger' in project 'Pods' via options '-lReact-logger' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-nativeconfig' in project 'Pods' via options '-lReact-nativeconfig' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-perflogger' in project 'Pods' via options '-lReact-perflogger' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-rendererdebug' in project 'Pods' via options '-lReact-rendererdebug' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-runtimescheduler' in project 'Pods' via options '-lReact-runtimescheduler' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'React-utils' in project 'Pods' via options '-lReact-utils' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'ReactCommon' in project 'Pods' via options '-lReactCommon' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'SocketRocket' in project 'Pods' via options '-lSocketRocket' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'Yoga' in project 'Pods' via options '-lYoga' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'fmt' in project 'Pods' via options '-lfmt' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'glog' in project 'Pods' via options '-lglog' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'libevent' in project 'Pods' via options '-llibevent' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'nodejs-mobile-react-native' in project 'Pods' via options '-lnodejs-mobile-react-native' in build setting 'OTHER_LDFLAGS'
    Target 'Pods-MWBuild8' in project 'Pods'
        ➜ Explicit dependency on target 'CocoaAsyncSocket' in project 'Pods'
        ➜ Explicit de

At this point I have tried to build using the command line that is logged out during the build process.
xcodebuild -workspace MWBuild8.xcworkspace -configuration Debug -scheme MWBuild8 -destination id=30D06C55-4E5C-413B-B76D-F6FED8BCFBDE

This results in an error:

nodejs-mobile-react-native requires Node.js version 16 accessible from Xcode, but found 21.2.0
Command PhaseScriptExecution failed with a nonzero exit code

warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MWBuild8' from project 'MWBuild8')
warning: Run script build phase '[CP-User] [NODEJS MOBILE] Copy Node.js Project files' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MWBuild8' from project 'MWBuild8')
warning: Run script build phase '[CP-User] [NODEJS MOBILE] Build Native Modules' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MWBuild8' from project 'MWBuild8')
warning: Run script build phase '[CP-User] [NODEJS MOBILE] Sign Native Modules' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MWBuild8' from project 'MWBuild8')
warning: Run script build phase '[CP-User] [NODEJS MOBILE] Remove Simulator Strip' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MWBuild8' from project 'MWBuild8')
** BUILD FAILED **


The following build commands failed:
        PhaseScriptExecution [CP-User]\ [NODEJS\ MOBILE]\ Build\ Native\ Modules /Users/brentmarshall/Library/Developer/Xcode/DerivedData/MWBuild8-dgukpfvpwgfckieaotecztardbrq/Build/Intermediates.noindex/MWBuild8.build/Debug-iphonesimulator/MWBuild8.build/Script-0DDAD9956D1608EA8D57D937.sh (in target 'MWBuild8' from project 'MWBuild8')
(1 failure)

If I try to build in XCode (after loading the .xcworkspace file I receive this error. I've confirmed that yoga/config/Config.h is visible from XCode:

/Users/user/Documents/ReactNative/MWBuild8/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h:16:10 'yoga/config/Config.h' file not found

I have tried deleting the DerivedData, /ios/pod & pod install, /ios/build, removing the /node_modules & npm install, deleting the apps on the simulator. I have also tried downgrading RN and nodejs-mobile. Restarting the Mac, restarting Terminal.

I can compile this on Windows + Android (but that doesn't help me when I need to hit an iOS target.

Any assistance is appreciated!

react-native info

  OS: macOS 14.0
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 3.38 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.2.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.3
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.0
    wanted: 0.73.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false```
@staltz staltz added fix Something isn't working document Improvements or additions to documentation .should and removed fix Something isn't working labels Dec 14, 2023
@staltz
Copy link
Member

staltz commented Dec 14, 2023

Thanks for the detailed report.

nodejs-mobile-react-native requires Node.js version 16 accessible from Xcode, but found 21.2.0

This is the error, and the suggestion for the fix is implicit. You have to set Node.js to 16 (by the way, are you sure you have nodejs-mobile-react-native 18.x.x installed? Because it should be saying "18" not "16"). Xcode doesn't detect the same paths as your default terminal, so it sometimes points to the incorrect Node.js version.

What I often do is run nvm use 16 inside ios/.xcode.env.local (a bash script file).

@eightlines
Copy link
Author

React Native needs Node.js >= 18. You're currently on version v16.20.2. Please upgrade Node.js to a supported version and try again.

I think the v21 came from a different terminal session. I've had many attempts fail. The Readme states that it does not follow semver, so the version number should compile on Node v18.17? Giving that a shot again.

@eightlines
Copy link
Author

Confirmed through react-native info, I'm running on 18.17. Node 16.2 won't init the project in RN (stalls at the same point in the original post), so that was a non starter. I'll see if I can downgrade RN to the last version that runs on v16.2. Can I ask what version of RN you would suggest to use?

@staltz staltz changed the title RN Fails to compile once Nodejs-mobile is added to project RN 0.73.x fails to compile once Nodejs-mobile is added to project Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document Improvements or additions to documentation .should
Projects
None yet
Development

No branches or pull requests

2 participants