react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.4k stars 903 forks source link

Invalid Podfile Error - dependency with no podspec #506

Closed RyanThomas73 closed 5 years ago

RyanThomas73 commented 5 years ago

Environment

System: OS: macOS 10.14.4 CPU: (8) x64 Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz Memory: 391.61 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.13.0 - /var/folders/st/dpvzyxq913s2mxv8dzb_fcv979pvgz/T/yarn--1562612651190-0.6482734780758797/node Yarn: 1.15.2 - /var/folders/st/dpvzyxq913s2mxv8dzb_fcv979pvgz/T/yarn--1562612651190-0.6482734780758797/yarn npm: 6.7.0 - /usr/local/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: 19, 21, 22, 23, 24, 25, 26 Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.3 System Images: android-19 | ARM EABI v7a, android-19 | Intel x86 Atom, android-21 | Android TV ARM EABI v7a, android-21 | Android TV Intel x86 Atom, android-21 | Android Wear ARM EABI v7a, android-21 | Android Wear Intel x86 Atom, android-21 | ARM EABI v7a, android-21 | Intel x86 Atom, android-21 | Intel x86 Atom_64, android-21 | Google APIs ARM EABI v7a, android-21 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom_64, android-22 | Android TV ARM EABI v7a, android-22 | Android TV Intel x86 Atom, android-22 | ARM EABI v7a, android-22 | Intel x86 Atom, android-22 | Intel x86 Atom_64, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Android TV ARM EABI v7a, android-23 | Android TV Intel x86 Atom, android-23 | Android Wear Intel x86 Atom, android-23 | Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-25 | Android TV Intel x86 Atom, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64 IDEs: Android Studio: 1.1.0 AI-135.1740770 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.0 => 0.60.0 npmGlobalPackages: react-native-cli: 2.0.1

Description

The use_native_modules! function defined in https://github.com/react-native-community/cli/blob/master/packages/platform-ios/native_modules.rb loads the list of react-native dependencies using the react-native config command. While iterating over these dependencies it does not null check the podspecPath value for null/nil to confirm a podspec is present.

The function attempts to load the pod spec using the null podspecPath value resulting in the pod install command outputting the following error message.

[!] Invalid 'Podfile' file: no implicit conversion of nil into String.

Reproducible Demo

  1. Configure a new react-native project using react-native version 0.60.0.
  2. Install a dependency into node_modules that the react-native config command will return in which the ios platform's podspecPath value is returned as null. (e.g. react-native-text-input-mask)
  3. Run the pod install command in the ios/ directory.

Expected Output: The command does not attempt to link the dependency since it does not have a .podspec.

Actual Output: The command errors with the described error message.

thymikee commented 5 years ago

Would you like to submit a PR for that? :) The error should state that you should contact library maintainers or send them PR with a podspec, based on e.g. https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec

RyanThomas73 commented 5 years ago

@thymikee I don't mind submitting a PR. Are you ok with me making the .rb script log a warning message about each dependency with no .podspec and allowing it to continue? Or do you feel there is a specific reason why it needs to fail the install task?

thymikee commented 5 years ago

It should fail the build and tell you how you can disable autolinking for a certain platform and link manually: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library, but I'd really like to prioritize helping the community to move forward

thymikee commented 5 years ago

Closed via https://github.com/react-native-community/cli/pull/507