Skip to content

use_native_modules! should take in consideration pod install --project-directory=ios option #657

Closed
@MoOx

Description

@MoOx

Environment

System:
    OS: macOS 10.15
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
    Memory: 975.33 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.15.1 - /var/folders/x_/wwvkzdz104n7j0m5jj2dq06m0000gn/T/fnm-shell-1102175/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /var/folders/x_/wwvkzdz104n7j0m5jj2dq06m0000gn/T/fnm-shell-1102175/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.0
      System Images: android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.9.0 => 16.9.0
    react-native: ^0.61.0-rc.0 => 0.61.0-rc.0

Description

If you don't run pod install from ./ios folder (eg: via pod install --project-directory=ios instead of cd ios && pod install, you can get this error

❯ pod install --project-directory=ios

[!] Invalid `Podfile` file: No such file or directory - ./node_modules/.bin/react-native.

 #  from /Users/moox/******/PROJECTROOT/ios/Podfile:74
 #  -------------------------------------------
 #
 >    use_native_modules!
 #  end
 #  -------------------------------------------

In this precise scenario, (pod install with --project-directory=ios), using use_native_modules!(".") instead of use_native_modules! does the trick (as default root value is "..").

That said, it's not a safe option as now, running pod install from ios folder won't work anymore.

Maybe this tool should take --project-directory option in consideration.

Reproducible Demo

You can reproduce this with any project that

  • have @react-native-community/cli-platform-ios" "^3.0.0-alpha.2 or something around that
  • have use_native_modules! in the ios/Podfile

Run from the root of the project (and not ./ios)

pod install --project-directory=ios

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions