-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
React Native's initial project doesn't run on IOS. #31249
Comments
I am facing the same issue with |
I am facing the same issue. React native 0.64 and Xcode 12.4 |
Can you please tell me the steps to build app in xcode ? |
|
@imkrunal no luck. Building the app from Xcode gives me the same error. |
Same issue. Works with Xcode. 👀 |
Make sure you don't have space in the folder names. Check this comment. |
|
Removing
from AND Commenting out all the code from |
Actually, this helps to make this stuff work but there is definitely an issue with I finally decided to do the same as @sumanbhattarai and rely on Is there someone aware of how the environment variables are set by Xcode for the build phases and how to customize/fix it ? |
We had the same issue when building on a build server with fastlane, when fastlane is started from a shell that has NVM environment variables set. |
@sumanbhattarai Why did you close this issue, I know that disabling NVM and removing code from find-node.sh resolves it, but then there must be a bug in find-node.sh which is under the control of the react-native project. It seems that some effort is going on in react-native to support also NVM, so this bug must be fixed, right? Or is it resolved in another issue? |
@hlynbech okay, i have reopened it. |
This patch got things working for me with diff --git a/node_modules/react-native/scripts/find-node.sh b/node_modules/react-native/scripts/find-node.sh
index c111e70..001de42 100755
--- a/node_modules/react-native/scripts/find-node.sh
+++ b/node_modules/react-native/scripts/find-node.sh
@@ -17,9 +17,9 @@ fi
# Set up the nodenv node version manager if present
if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
- eval "$("$HOME/.nodenv/bin/nodenv" init -)"
+ eval "$("$HOME/.nodenv/bin/nodenv" init --no-rehash -)"
elif [[ -x "$(command -v brew)" && -x "$(brew --prefix nodenv)/bin/nodenv" ]]; then
- eval "$("$(brew --prefix nodenv)/bin/nodenv" init -)"
+ eval "$("$(brew --prefix nodenv)/bin/nodenv" init --no-rehash -)"
fi
# Set up the ndenv of anyenv if preset
This is specific to I didn't look into all the details, but this seemed to be the ultimate error.
Here's my full (more or less) Build Phases log for
|
@williamhaley's fix pointed me in the right direction. Looking into the Naturally, I thought |
I was seeing the same issue on a new project created with RN 0.64.1. Explicitly running |
I ONLY commented out Think this will cause me headaches in the future? hopefully, a true fix and less of a patch will be coming soon. (edit 5/20/21 - broke again - going to try other solutions from above and below 😂 ) |
@levymetal Do you know if your fix could in any way apply to environments where |
@hlynbech shims are an Also, even if you aren't actively using |
i had the same problem probably was some path variable bad configured with mvn and node, i solved removing nvm, node and reinstall all be attention with the node version that you need, good luck |
SOLVED |
For me, none of the above solutions haven't worked :( |
I fixed this by making sure my bash prefix is set to something like |
I finally solved it, I updated my node (not in nvm). And I made sure that the node in nvm is the last version |
I had this issue when I was running node v15. I installed lts node version v14.17.5 with nvm without messing with nvm and it built properly and ran on macOS |
Try removing the spaces on the project path and run it Eg. React Native Projects/yourproject to ReactNativeProjects/yourproject It resolved the problem for me |
So the issue for me was related to how I setup NVM to rewrite the cd command to switch node versions based on the .nvmrc file. When I removed the cdnvm command as seen here https://github.com/nvm-sh/nvm#automatically-call-nvm-use then it all worked. Hopefully, this helps someone. |
So the issue for me was because my Jenkins worker was still on bash. I moved it to zsh. Deleted .nvm for safety(not sure if it made a difference). This seemed to work for me and was able to successfully build with fastlane too. |
I solved this by using fnm instead of nvm |
Same Issue on Microsoft App Center |
I've had this issue using Fastlane on our CI server, in order to fix the issue, I added some commands to clean pods entirely and do a completely clean installation - before running the Fastlane bundle commands
It was using cache from previous pods/builds. If you're having this issue you can try these commands above. |
I know there seem to be some solutions here but none worked for me. The solution that ended up working was really simple. Go through the absolute path of your project, and make sure there are no spaces! I had to edit a file in a directory 3 parents prior to my app folder. For me it was something like "users/.../Desktop/school/class abc/test/project" <- I had to make it 'class-abc' |
Thanks this works for me |
I am on react 0.67.2 (new project) I tried on two different machines with this issue. |
I had the same problem, but I fixed it using |
Thanks alot, This worked for me. I spent alot of time trying to find a solution for this. |
@mineturtle2137 's solution solved it for me, thank you so much man!! 🙏 🙏 🙏 🙏 🙏 🎉 🎉 🎉 |
Below solution fixed issues for me. Commenting out all references for NVM_DIR in project_repository/node_modules/react-native/scripts/find-node.sh and ~/.bash_profile fixed the issue. Sample code
|
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
I created a new project using the command
npx react-native init MyApp --template react-native-template-typescript
.When i run
npx react-native run-ios
, it gives me below error.React Native version:
System:
OS: macOS 11.2.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 58.32 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.11 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 14.0.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
The text was updated successfully, but these errors were encountered: