Integration to existing Apps: require_relative not working as expected. Only works if the App is inside the React Native root ios directory #33941
Labels
Platform: iOS
iOS applications.
Resolution: For Stack Overflow
A question for Stack Overflow. Applying this label will cause issue to be closed.
Tool: CocoaPods
Description
I am trying to use require_relative, but it seems like it only works when the folder structure is like this:
and try to do pod install with podFile as:
this succeeds installation, however, if I update the structure like this:
and try to do pod install with podFile as:
this fails with the following error:
I have two things to question:
ios
it works fine which is kind of wierd.ios
and thenode_modules
sit into two different directories:https://github.com/sedhha/<IOS>
andhttps://github.com/sedhha/<node_modules>
. In that case, I can't userequire_relative
is there a better way to fetch them globally, something likerequire_absolute: git: https://<address_to_git_repo>
.Version
0.68.2
Output of
npx react-native info
System:
OS: macOS 12.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 6.64 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.2.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.6.0 - /usr/local/bin/npm
Watchman: 2022.05.16.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_312 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.2 => 0.68.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
require_relative
and you will see the above error when doingpod install
.Snack, code example, screenshot, or link to a repository
CASE 1: podFile when installation succeeds:
CASE 2: podFiles when installation fails:
CASE 3: podFiles whne installation fails:
The text was updated successfully, but these errors were encountered: