sayem314/react-native-keep-awake

Error with pod install command

josmmv opened this issue ยท 29 comments

josmmv commented

When I run the command RCT_NEW_ARCH_ENABLED=1 pod install in the ios folder, I get this error:

[!] Invalid `Podfile` file: 
[!] Invalid `react-native-keep-awake.podspec` file: undefined local variable or method `folly_compiler_flags' for Pod:Module.

 #  from /.../node_modules/@sayem314/react-native-keep-awake/react-native-keep-awake.podspec:24
 #  -------------------------------------------
 #    if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
 >      s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
 #      s.pod_target_xcconfig    = {

@zabojad can you please take a look at this?

@ErHarinderSingh @josmmv I dont have that with RN 0.71.10

What version of RN are you using?

OK, I've found the problem, it will happen on any RN version <= 0.70 with new architecture enabled.

I'll issue a PR to fix that.

the PR is open...

@zabojad, thank you for the prompt resolution.

@josmmv and @ErHarinderSingh, could you please review the new version 1.2.1 and provide us with your feedback?

Hi @sayem314 , @zabojad thanks for your solution. It's working fine as no error shown now. My build is not compiling right now as I am using react-native-share library and it also has same error.
Screenshot 2023-07-06 at 15 25 36
Can we refer this fix to them as well?

@ErHarinderSingh I'll issue a PR on react-native-share as well...

@zabojad @sayem314
Now compile time issues.
Screenshot 2023-07-06 at 21 11 33

@ErHarinderSingh what version of react native are you using ?

@zabojad I am using 0.72.1 latest

@ErHarinderSingh I've just created a new 0.72.1 project, added react-native-keep-awake, did RCT_NEW_ARCH_ENABLED=1 pod install and ran it on device. It compiled and ran without any problem...

You might try to clean the build folder in XCode and retry to compile it...

@zabojad, @sayem314,it's not working. I tried all the ways, reinstall pods after deleting Podfile.lock file, clear build folder from xcode.
From CLI I am getting below error.
Screenshot 2023-07-07 at 14 39 38

Can you try compiling/running on a real device ๐Ÿค” ?

@ErHarinderSingh can you share your application podfile ? Is there anything you've customized there?

@ErHarinderSingh Can you also please share the output of npx react-native info ?

@josmmv Is the issue fixed at your end ?

@ErHarinderSingh I don't get it... I don't reproduce that error at my end and I tried.

I've also checked if the classes NativeKCKeepAwakeSpec and NativeKCKeepAwakeSpecJSI are actually generated by codeGen and they actually are:

Screenshot 2023-07-07 at 22 10 05

@ErHarinderSingh thinking about that now, it would be interesting to see what codeGen does at your end.

Can you please show us what it generates in your project when you do this:

cd <path/to/your/app>
node node_modules/react-native/scripts/generate-codegen-artifacts.js \
    --path <your app>/ \
    --outputPath <an/output/path> \

I generated codeGen. Can we connect somehow on zoom or something else? I think that way you can find your bug easily.
@zabojad @sayem314 ? I also requested you on LinkedIn, may be I can help in many ways, Thanks.

Hi @zabojad , @sayem314 it also happened on fresh project for me.
Steps :
npx react-native init d
cd d
yarn add @sayem314/react-native-keep-awake
cd ios && bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install && cd ..
npx react-native run-ios --simulator="iPhone 14 Pro"

Still facing this error; strange.

Screenshot 2023-07-08 at 12 53 59

Hi @zabojad @sayem314 , Now I deleted xCode & reinstalled but still those same errors. Strange.

Hi @ErHarinderSingh !

I've just reproduced the problem by installing the npm version of @sayem314/react-native-keep-awake instead of my local version...

I thus can investigate on this. I keep you updated as soon as I've found why it's happening...

OK, I've found the cause of the problem: codeGen doesn't generate the JSI classes because of this commit: 5a22a8f

@sayem314 can you please revert it? The module specification should be kept as pure ts (or flow) as in my original PR... This is what allows codeGen to generate the JSI stuff correctly.

@ErHarinderSingh in the meantime, you can use my fork until @sayem314 fixes this...

@zabojad Thank you. v1.2.2 published to npm.

Thanks @zabojad @sayem314 , No problem. I can wait today. I am waiting for new version come out of the box.
Thanks for understand things.

Now working fine after upgrading to v1.2.2. Build successfully compiled.
Thanks. :)
@zabojad @sayem314