lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.83k stars 656 forks source link

GeneratedInfoPlistDotEnv.h' file not found #83

Closed deno028 closed 2 years ago

deno028 commented 7 years ago

I created a new scheme with new Configuration build : releaseDev

"react-native": "0.37.0", "react-native-config": "^0.3.0",

When archiving I got this error:

fatal error: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyProject-xxx/Build/Intermediates/ArchiveIntermediates/myDevScheme/BuildProductsPath/ReleaseDev-iphoneos/GeneratedInfoPlistDotEnv.h' file not found

Notes: it works with default configuration builds: release and debug.

ghost commented 5 years ago

If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?

Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.

  1. yarn add https://github.com/luggit/react-native-config.git

  2. cd ios && pod install

You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

nicolashemonic commented 4 years ago

If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?

Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.

  1. yarn add https://github.com/luggit/react-native-config.git
  2. cd ios && pod install

You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

0.12 don't work with React Native 0.6+ auto linking or not. I was obliged to downgrade to 0.11.7 and link the module manually, thanks to: https://github.com/luggit/react-native-config/issues/414#issuecomment-559014103

Taylor123 commented 4 years ago

@nicolashemonic do you have the GeneratedInfoPlistDotEnv.h in any of the preprocessing build settings?

denisdimitrov commented 4 years ago

I no longer needed the dependency and I removed it and it's pods, however I kept getting the following error:

The fix was simple yet time consuming:

  1. Remove ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h from Info.plist Preprocessor Prefix File
  2. Set Preprocess Info.plist File to No
tpucci commented 4 years ago

@nicolashemonic Perhaps this will help: https://github.com/luggit/react-native-config/issues/391#issuecomment-571948199

mechazod commented 4 years ago

@denisdimitrov Just followed your suggestion.

rafaelmaeuer commented 4 years ago

https://github.com/luggit/react-native-config/issues/391#issuecomment-632331803 describes how to generate the file, so it should give the right hint for anyone who needs to remove it.

ElliDy commented 4 years ago

Setting ${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h on the project ONLY is what worked for me after trying everything else.

Thanks @moroz0v, this worked for me. Setting it ONLY on project and NOT on the targets is the secret here.

lukewlms commented 4 years ago

My solution was pretty specific - mine was failing only when testing with Detox, but working fine with normal run-ios. I fixed it by changing this setting in my Detox build command:

-derivedDataPath ios/build

To point to the Xcode DerivedData directory, where the .h file can actually be found:

/Users/me/Library/Developer/Xcode/DerivedData/mobile2mr-xxxx

blinkyweezy commented 3 years ago

for anyone who couldn't find a solution, how i solved mine was to navigate to the folder that was mentioned in the error message. mine was /Users/user/Library/Developer/Xcode/DerivedData/app-gehbcoezzoencvciaviqaurqghcg/Build and ran this code in the terminal at that folder, touch GeneratedDotEnv.m GeneratedInfoPlistDotEnv.h && echo "#define DOT_ENV @{ };" >> GeneratedDotEnv.m. cleaned the project and it worked :))

GastonRosso commented 2 years ago

If anyone is still having the problem, my issue was that I was opening Xcode in ios folder, what solved it for my was opening xcworkspace file from Xcode.

deno028 commented 2 years ago

Sorry guys, I've been offline for a while. I think new versions this issue was solved.

spsaucier commented 2 years ago

We fixed by removing the requirements for GeneratedInfoPlistDotEnv.h, since it's not recommended by the react-native-config Readme anymore, and then we followed the instructions towards Config.xcconfig enabling env vars in Info.plist: https://github.com/luggit/react-native-config#availability-in-build-settings-and-infoplist, making sure that our Info.plist was using the proper $(VAR) syntax.

naveenprakash74 commented 8 months ago

I am using Apple M2 chip I fixed it by using rosetta mode and it is working fine for me go to Product->destination-> destination architecture -> select "show Rosetta Destination"