-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
iOS EAS build #19
Comments
Hi @jole141 . It is the first time I hear about an "EAS Build". I googled, and if I got it right, it is a purely Expo build option? If so, as mentioned in [#8], the official support of Expo is currently beyond my reach and nearest plans, although it is probably on the table for more distant future, and some folks seem to have managed to use this library for Expo already. This told, from you message it reads like you actually got the server build and successfully launched for you environment. Getting 404 Not Found only means that server is not able to locate the files, either because you misconfigured it, or because there is some minor bug preventing it to look for files in the correct place.
This should be possible, I don't see why not. If your app downloads, or otherwise generates a JSON file, and writes it into the folder being served by this static server, then the server will serve that JSON file. |
Hi @birdofpreyru, I managed to get the servers working on Expo, even though I use Expo eject and build through EAS, but everything works and I organized the folders. I didn't have any problems with folders for IOS, but for Android, I struggled a bit because I had to copy files from internal memory to external memory to be able to access them. However, I am still testing everything, and when I sort everything out, maybe I can help you with Expo support. I have currently noticed that the IOS server does not work when I am on mobile data, but I have raised a new issue for that. |
Yeah... depending on when you checked the README the last time, this Android peculiarity is mentioned now there, and there is a dedicated extractBundledAssets() function in the library to help with it.
That will be awesome! Even if there is no need for code changes, a PR to README to cover Expo installation would be great! |
@jole141, would appreciate if you describe how you got it working for Expo. As mentioned in other issue thread ‘https://github.com/birdofpreyru/react-native-static-server/issues/8’, Expo prebuild to be used, so that the library's native dependencies would be linked and Pods installed. So, I am using expo prebuild. Here, is the screenshot from iOS emulator. Would appreciate any help! |
@gopinath-subramanian I guess, there is just some problem with what you are doing. What is your RN version, build host, target OS, are you using old or new RN arch? I am pretty sure there is no better alternatives for local file serving with RN, thus you better help to trouble shoot and improve this library ;) |
|
@gopinath-subramanian and you do the build on Linux? MacOS? |
Using macOS |
That's odd. It supposed to work, apart when it fails for some ppl on building step due to issues with cmake configuration on some systems. Have you tried to run the example app, included into this repo? |
Yes now we are trying the example app from this repo , will update you the outcome soon thanks |
After I cloned your example then tried npm install and npm start then cd ios pod install..Then opened the project in Xcode when I build it failed Here is the info about all my settings System: |
@pavelstepanov-paf I use eas build because I already use some native packages in the application I'm working on, so I use eas build (development) and I didn't do anything new for this package. I just installed the package via yarn add and created an eas development build and everything works fine. The build only passes on version 0.5.5 for iOS and I'm currently trying to make it work on version 0.7.2. Unfortunately, I cannot share my code because it's the application of the company I work for, but if I have some time, I might create a simple Expo project with this package so that you can try it out and see if it works. @birdofpreyru Any ideas for this error?
|
Hey @gopinath-subramanian and @jole141 , in both your cases the build fails at CMake build step, please look up into detailed logs from the step on what exactly went wrong there. @gopinath-subramanian are there more details if you expand that error message, pressing on icon with three horizontal bars? If not, can you locate the folder with intermediate build artifacts, and look up there? E.g. what @jole141 qoutes, there is the path to the actual shell script |
PhaseScriptExecution [CP-User]\ Build\ native\ dependencies /Users/gopinath/Library/Developer/Xcode/DerivedData/ReactNativeStaticServerExample-cpaujgnqfzfufsalvnkovoawcojp/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/dr-pogodin-react-native-static-server.build/Script-46EB2E00019580.sh (in target 'dr-pogodin-react-native-static-server' from project 'Pods') CMake Warning (dev) at CMakeLists.txt:83: Argument not separated from preceding token by whitespace. CMake Warning (dev) at CMakeLists.txt:84: Argument not separated from preceding token by whitespace. CMake Warning (dev) at CMakeLists.txt:85: Argument not separated from preceding token by whitespace. CMake Warning (dev) at CMakeLists.txt:1 (project): CMake Warning (dev) at CMakeLists.txt:1 (project): The following variable(s) would be set to empty:
This warning is for project developers. Use -Wno-dev to suppress it. -- The C compiler identification is AppleClang 13.0.0.13000029
is not able to compile a simple test program. It fails with the following output:
CMake will not be able to correctly generate this project. -- Configuring incomplete, errors occurred! User defaults from command line: Build settings from command line: xcodebuild: error: 'PCRE2.xcodeproj' does not exist. -- Configuring incomplete, errors occurred! |
Thanks @gopinath-subramanian , looking at the log, it turns out on your system it fails to build included PCRE2 sources, saying:
It should be happening at this point (it instructs CMake to spawn a child CMake build for PCRE2 in a separate process). My first thought was, it is somehow wrong for iPhone simulator (I most of the time test with a real device), but I just rapidly double-checked, that on my MacOS machine it still works fine when building & running on simulator. Can you dig into it yourself? I wonder, can it be something missing / damaged in your XCode / dev setup? |
OK thanks, i will check more in detail |
When I run this script in the command line it says xcodebuild: error: 'PCRE2.xcodeproj' does not exist. |
That is already after the initial failure. If you look at CMakeLists.txt of the library, this is what fails first — that command is supposed to do cmake configuration and generate that PCRE2.xcodeproj, which it fails to do on your machine, complaining the C compiler is not usable. What you posted above comes from the next command, which actually triggers the build of PCRE2 project generated by the previous command. |
Hi @birdofpreyru I fixed it by creating a pre-install script for installing cmake |
@birdofpreyru if PCRE2 is causing build challenges for you, you might consider always building lighttpd without PCRE and without PCRE2. lighttpd uses PCRE2 for specific lighttpd features which are not required for many typical operations. Currently, PCRE2 can enhance lighttpd configuration conditions (exact string match, prefix match, suffix match, regex match). Without PCRE2, regex match is not available. Without PCRE2, However, if you are not exposing these features in the lighttpd config currently generated by your code, then you can safely omit PCRE and PCRE2 from your build, until you are ready to expose those features. |
@jole141 I also have the 404 not found error after building an iOS app with EAS. Everything works fine in the emulator, but as soon as I try to install the app on an physical device i got 404 not found, the fact that it work on the emulator make me think that's because the webroot folder is not set up in the EAS build.
And here is my package.json:
If you have any idea what I did wrong, I would greatly appreciate your help. |
@camdarley perhaps, it just ends up on a different path on the device? Kind of reminds me the difference between iOS and macOS (Catalyst) — they work all the same, but bundled-in artifacts end-up on slightly different base paths, leading to the same 404 errors if not taken into account. |
@birdofpreyru Thanks for your answer, but |
It should, but perhaps it does not, for your case — I don't officially support Expo, thus I haven't tested it. That's why I commented — perhaps you should check where your files actually land on the device, and if that is the problem, to make a PR fixing |
I use EAS Build which currently only works with version 0.5.5 for iOS. However, the real challenge is successfully installing the package and launching the server. I'm not sure how to set up the folder to serve files via EAS Build, so I'm wondering if there are any ideas on how to achieve this. I received a message that the server has been launched and it's up and running on URL "192.168....". However, when I tried to access the server via the provided link, I got a 404 Not Found error. I'm not sure how to access the files on iOS, so I'm seeking assistance in resolving this issue.
I have another question, is it even possible for me to fetch some data, like a JSON file, over the internet in my application and then serve that same JSON file on my server in the application? I need this npm package for that, but I'm not sure if I can achieve it
The text was updated successfully, but these errors were encountered: