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

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

Closed
MoOx opened this issue Sep 2, 2019 · 4 comments · Fixed by #768
Closed
Labels
bug Something isn't working

Comments

@MoOx
Copy link
Contributor

MoOx commented Sep 2, 2019

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
@MoOx MoOx added the bug Something isn't working label Sep 2, 2019
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue May 23, 2020
Part of the RN v0.59.10 -> v0.60.0 upgrade [1]. (Or, at least, RN
and most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern,
   so you can just look at the third:

   261197d85 Implement changes to enable native modules auto linking (#24506)
   da7d3dfc7 Partially back out #24506, fixing iOS e2e tests (#24788)
   86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main upgrade
   commit, earlier in this series, where we moved to RN v0.60.0.

4. Add our two dependencies that we explicitly do not link on iOS to
   the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

Closes: zulip#4026

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 1, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern:

   - 261197d85 Implement changes to enable native modules auto
   linking (#24506)

   - da7d3dfc7 Partially back out #24506, fixing iOS e2e tests
   (#24788)

   - 86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the ">=
   0.60" branch of the "Configure iOS" instructions. Turns out that
   no changes are needed here; the differences in expressing our
   React pod dependencies were handled in the main RN v0.60 upgrade
   commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

Closes: zulip#4026

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 1, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern:

   - 261197d85 Implement changes to enable native modules auto
   linking (#24506)

   - da7d3dfc7 Partially back out #24506, fixing iOS e2e tests
   (#24788)

   - 86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the ">=
   0.60" branch of the "Configure iOS" instructions. Turns out that
   no changes are needed here; the differences in expressing our
   React pod dependencies were handled in the main RN v0.60 upgrade
   commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

Closes: zulip#4026

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 1, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern:

   - 261197d85 Implement changes to enable native modules auto
   linking (#24506)

   - da7d3dfc7 Partially back out #24506, fixing iOS e2e tests
   (#24788)

   - 86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the ">=
   0.60" branch of the "Configure iOS" instructions. Turns out that
   no changes are needed here; the differences in expressing our
   React pod dependencies were handled in the main RN v0.60 upgrade
   commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

Closes: zulip#4026

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 3, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern:

   - 261197d85 Implement changes to enable native modules auto
   linking (#24506)

   - da7d3dfc7 Partially back out #24506, fixing iOS e2e tests
   (#24788)

   - 86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the ">=
   0.60" branch of the "Configure iOS" instructions. Turns out that
   no changes are needed here; the differences in expressing our
   React pod dependencies were handled in the main RN v0.60 upgrade
   commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 3, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the changes recommended by these commits in
   `facebook/react-native`. They follow an A, revert-A, A' pattern:

   - 261197d85 Implement changes to enable native modules auto
   linking (#24506)

   - da7d3dfc7 Partially back out #24506, fixing iOS e2e tests
   (#24788)

   - 86a97e783 – Bring back autolinking to the iOS template (#25314)

   It simply imports and runs a command, `use_native_modules`.

3. Now, go back to `react-native-unimodules` and follow the ">=
   0.60" branch of the "Configure iOS" instructions. Turns out that
   no changes are needed here; the differences in expressing our
   React pod dependencies were handled in the main RN v0.60 upgrade
   commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 4, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by `facebook/react-native@86a97e783`:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
chrisbobbe added a commit to zulip/zulip-mobile that referenced this issue Jun 4, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by `facebook/react-native@86a97e783`:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     #4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: #4026
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 5, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by `facebook/react-native@86a97e783`:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 5, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by facebook/react-native@86a97e783:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 8, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by facebook/react-native@86a97e783:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 8, 2020
Part of the RN v0.59 -> v0.60 upgrade [1]. (Or, at least, RN and
most library maintainers assume it is done as such.) This must
happen at or after the upgrade commit because autolinking is a new
feature.

Just like the previous commit, but for iOS.

1. Following the doc [2] as before, unlink everything. Again, with a
   script, but this time, only for iOS:

   ```
   for dep in `tools/deps`; do
     react-native unlink --platforms=ios "$dep"
   done
   ```

   Exclude the same set of Sentry changes as we did in this step for
   Android. Also, exclude a change to our Info.plist that would
   remove the "Fonts provided by application", a.k.a., `UIAppFonts`.
   This is a setup step [3] that we need to keep.

   So, we're left with the removal of all items from the "Pods we
   need that depend on React Native" list.

   Additionally, remove "libz" from our Xcode config. It was put
   there by Sentry, as a consequence of running `react-native link`
   before we were using CocoaPods. But Sentry expresses the same
   dependency in `Sentry.podspec`. So, having it in our Xcode config
   is redundant. [4]

2. Make the change recommended by facebook/react-native@86a97e783:
   import and call a method, `use_native_modules!`.

3. Now, go back to `react-native-unimodules` and follow the
   ">= 0.60" branch of the "Configure iOS" instructions. Turns out
   that no changes are needed here; the differences in expressing
   our React pod dependencies were handled in the main RN v0.60
   upgrade commit.

4. Move the two deps under "RN-dependent Pods that we could include,
   but we've decided not to" into the `react-native.config.js`.

5. Add a workaround in `tools/postinstall` for an issue [5] with
   running `pod install` from the root directory with
   `--project-directory=ios`.

   We tried the workaround suggested in that issue, where we have
   `use_native_modules!(".")` in the Podfile and still call
   `pod install --project-directory=ios` from the root directory.
   (This might have led to a cleaner solution, where we pass "." in
   the postinstall case, and pass nothing otherwise.) But we got
   this error, which isn't addressed in that issue, and doesn't seem
   easy to fix without changes to `native_modules.rb`:

   ```
   [!] No podspec found for `RNCAsyncStorage` in
   `./node_modules/@react-native-community/async-storage`
   ```

   It's plausible that those investigating this issue were only
   testing with a template project that didn't have RN-dependent
   pods like RNCAsyncStorage, so, never saw this error.

6. Run `pod install` and see that the only change to
   `ios/Podfile.lock` is in the checksum. So, job done.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6

[2]: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

[3]: https://github.com/oblador/react-native-vector-icons#option-manually

[4]: There's some uncertainty here; we're not seeing `z` or `libz`
     in ios/Pods/Pods.xcodeproj/project.pbxproj after running `pod
     install`, with or without autolinking. But it seems to work.
     More discussion at
     zulip#4026 (comment)
     and
     https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/RN.20autolinking/near/884333.

[5]: react-native-community/cli#657

Fixes: zulip#4026
@redreceipt
Copy link

I'm sorry has this issue been resolved? How do I pick up the fix?

@redreceipt
Copy link

@MoOx I tried to use the workaround you described use_native_modules!(".") but am getting an error, no podspec found. Seems auto-linking is still having trouble???

Screen Shot 2020-08-21 at 9 40 57 AM

@gz1992
Copy link

gz1992 commented Jul 14, 2022

if it helps... when I :
1- removed my @react-native-community/cli-platform-ios from package.json
2- ran yarn
3- removed Pods
4- and on terminal, project root
cd ios && pod install

It worked for me

@MuhammadBilal60803
Copy link

MuhammadBilal60803 commented Nov 15, 2022

project-directory=i

@MoOx I tried to use the workaround you described use_native_modules!(".") but am getting an error, no podspec found. Seems auto-linking is still having trouble???

Screen Shot 2020-08-21 at 9 40 57 AM

in your podfile, change the path from './node_modules/react-native-linear-gradient' to '../node_modules/react-native-linear-gradient
and then run "pod install"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants