react-native-keep-awake: Error with pod install command

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    = {

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 29 (3 by maintainers)

Most upvoted comments

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

OK, I’ve found the cause of the problem: codeGen doesn’t generate the JSI classes because of this commit: https://github.com/sayem314/react-native-keep-awake/commit/5a22a8f26fc37aee54ebea0a1167b0710c8d3635

@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…

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…

@ErHarinderSingh I’ll issue a PR on react-native-share as well…

@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?

the PR is open…

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.

@ErHarinderSingh @josmmv I dont have that with RN 0.71.10

What version of RN are you using?

@zabojad can you please take a look at this?

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

@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> \

@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 Can you also please share the output of npx react-native info ?

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

Can you try compiling/running on a real device 🤔 ?

@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…

@ErHarinderSingh what version of react native are you using ?