-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Failure to Generate iOS React Native 0.72.12 Project in Custom Directory #44176
Comments
|
|
Here are a few suggestions that might help:
You can switch between different Node.js versions using Node Version Manager (NVM). Here are the steps: "This has worked wonders for me while using React Native as the
Remember, you need to have the desired version of Node.js installed on your machine before you can switch to it. If the version is not installed, you can install it using Please note that these commands are for Unix-based systems like Linux and macOS. If you're using Windows, you might want to use [nvm-windows], a similar tool for managing Node.js versions. The commands for nvm-windows are slightly different. I hope this helps! Source: Source: |
Hi @ywqqqqq, the problem in moving the iOS project outside the react-native suggested structure, is that it breaks some assumptions on where the files are located. For example, in the Podfile, we do this:\ # Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip to require the Why do you need to move the Otherwise, you need to figure out all the path that broke, starting from this |
Hey @cipolleschi, Thanks for your reply. I had spent several days trying to modify the paths in this piece of code you mentioned , but I failed.
The reason for such directory modification is historical. Our project's module directory consists of multiple pods, with each being one of the pods for React Native. The Actual structure like below: └── XXProgram Is it possible to upgrade React Native with this structure? |
You can try to hardcode the require_relative '../<path_to_node_modules>/react-native/scripts/react_native_pods.rb' the first I think it would be simpler if you can accept to move back React Native And have something like:
This config should be supported out of the box. |
Due to the project containing a dozen native pods, modifying the directory structure is not easy.
The hardcode
It seems like the project root directory gone. The issue is occurring in this line of
So I try to hardcode this However, hardcoding here is not a good solution. Do you have any better suggestions?:):)@cipolleschi |
It is not bad if it works for your use case and you don't have to ship libraries to anyone. The problem is that you'll have to reapply the fix every time the node_modules changes or get updated. The usual solution in these cases is to leverage a |
Description
If the project structure follows the one below, running pod install is successful:
└── guideProgram
⠀⠀⠀⠀⠀├── package.json
⠀⠀⠀⠀⠀├── node_modules
⠀⠀⠀⠀⠀└── ios
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀└── Podfile
However, when the structure is customized as follows:
└── myProgram
⠀⠀⠀⠀⠀├── rn
⠀⠀⠀⠀⠀├── ├── node_modules
⠀⠀⠀⠀⠀├── └── package.json
⠀⠀⠀⠀⠀└─ ios
⠀⠀⠀⠀⠀⠀⠀⠀└── Podfile
It results in an error message:
"[!] Invalid Podfile file: undefined method `prepare_react_native_project!' for #Pod::Podfile:0x00007f8733259588."
It has been bothering me for several days now!
Steps to reproduce
React Native Version
0.72.12
Affected Platforms
Runtime - iOS, Build - MacOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
http://www.github.com
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: