Skip to content
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

GeneratedInfoPlistDotEnv.h' file not found #83

Closed
deno028 opened this issue Feb 8, 2017 · 64 comments
Closed

GeneratedInfoPlistDotEnv.h' file not found #83

deno028 opened this issue Feb 8, 2017 · 64 comments

Comments

@deno028
Copy link

deno028 commented Feb 8, 2017

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.

@christophby
Copy link

Same here

@darrenchiu
Copy link

same here

@robbykim
Copy link

robbykim commented Feb 14, 2017

+1

edit: had this issue even having run 'react-native link'

@l3wi
Copy link

l3wi commented Feb 15, 2017

+1

edit: was having this issue until I realised I hadn't run "react-native link"

@iamrutvik
Copy link

+1,

Even after linking it did not work

@coreyar
Copy link

coreyar commented Feb 27, 2017

I had this problem using a previous version of react-native-config. I was able to resolve it by updating to 0.3.0, unlinking react-native-config, cleaning my project, and deleting ios/build.

@cristianrosu
Copy link

cristianrosu commented Feb 28, 2017

Make sure you do the preprocess settings under Build Settings while having the main project selected, not a target. This was causing the error in my case. 😄

@deno028
Copy link
Author

deno028 commented Mar 1, 2017

@coreyar: I try both 0.3.0 and 0.3.1 unlink and relink but still failed. Are you using with multi build configurations instead of default "release and debug"?

@cristianrosu : This error throw from preprocessor.

@deno028
Copy link
Author

deno028 commented Mar 1, 2017

I find that the BuildDotenvConfig.ruby wrote to wrong file:
Because the value of ENV["CONFIGURATION_BUILD_DIR"] diffrent with ${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h in Preprocessor Prefix Info.plist config.

Reading env from .env.dev
Wrote to /Users/xxx/Library/Developer/Xcode/DerivedData/MyProject-agbpncwqiroipybewdcexatgmqjc/Build/Products/Release-iphoneos/GeneratedInfoPlistDotEnv.h

But the preprocess script check the link:

fatal error: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyProject-agbpncwqiroipybewdcexatgmqjc/Build/Products/ReleaseDev-iphoneos/GeneratedInfoPlistDotEnv.h' file not found
#include "/Users/xxx/Library/Developer/Xcode/DerivedData/MyProject-agbpncwqiroipybewdcexatgmqjc/Build/Products/ReleaseDev-iphoneos/GeneratedInfoPlistDotEnv.h"

@deno028
Copy link
Author

deno028 commented Mar 2, 2017

After all I find the solution for this :

Set the value for Info.plist Preprocessor Prefix File
${SYMROOT}/Release$(EFFECTIVE_PLATFORM_NAME)/GeneratedInfoPlistDotEnv.h

Instead of the one from documentation:
${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h

@masiamj
Copy link

masiamj commented Mar 13, 2017

+1 - great fix @deno028

@wholcman
Copy link

Try to double check if there is no space when you copy/paste ${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h in the preprocessor prefix file.

@Johan-dutoit
Copy link

Johan-dutoit commented Apr 3, 2017

Any solution for this? Tried linking and different preprocessor.

@deno028
Copy link
Author

deno028 commented Apr 5, 2017

@Johan-dutoit : What problem have you got? Any error message?

@iamrutvik
Copy link

iamrutvik commented Apr 5, 2017 via email

@jordanmkoncz
Copy link

I was getting this error for a new "Staging" scheme I had created. The standard release scheme was working but the Staging scheme was not. @deno028 your suggestion worked for me.

@Johan-dutoit
Copy link

@deno028 I eventually got it to work with the new config, using your above solution. Guess it was just not cleaned/built correctly after I initially made the change.

@salujaharkirat
Copy link

I faced similar issue when I removed the node_modules folder to check something. Linking again using react-native also did not work.

So, tried unlinking and linking it again.

react-native unlink react-native-config
react-native link react-native-config

After this it works fine for me

@PeterRock
Copy link

PeterRock commented Apr 27, 2017

I fix it.
Set the value for Info.plist Preprocessor Prefix File
$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/GeneratedInfoPlistDotEnv.h

@eugenehp
Copy link

eugenehp commented May 4, 2017

I also found that INFOPLIST_PREFIX_HEADER should be adjusted as well. See my changes here: eugenehp@9792326

@ujwal-setlur
Copy link

I had to set it to the ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

Looking at the BuildDotenvConfig.ruby file, it writes the header file to:

# write it so the Info.plist preprocessor can access it
path = File.join(ENV["BUILD_DIR"], "GeneratedInfoPlistDotEnv.h")
File.open(path, "w") { |f| f.puts info_plist_defines_objc }

So, I ended up changing the Info.plist Preprocessor Prefix File setting to ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

This has to be done for the Project and all targets. In my case, in three places.

@xilibro
Copy link

xilibro commented May 18, 2017

I install the latest version, and i found difference between README.md and web page
In README.md:

  • Set Info.plist Preprocessor Prefix File to ${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h

on web page:
Set Info.plist Preprocessor Prefix File to
${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

After i change my config as in READEME.md , it works well

@cocymsc1986
Copy link

cocymsc1986 commented May 24, 2017

@pedro will one of the above be accepted? There a few different answers here, seems to be different things work for different people.

Just to add my bit - for me, I deleted my node_modules folder, re-installed node modules and then installed and linked react-native-config. I then used ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h instead of what is suggested in the readme and it worked for me.

@PolGuixe
Copy link

PolGuixe commented Jun 5, 2017

In my case I couldn't find any. Is there way to better debug the process?

@digitaldavenyc
Copy link

Changing Info.plist Preprocessor Prefix File to ${BUILD_DIR}/GeneratedInfoPlistDotEnv.hworked for me as well.

I looked in the build directory and it seems the path for CONFIGURATION_BUILD_DIR looks inside Debug-iphonesimulator directory. The GeneratedInfoPlistDotEnv.h is a directory above this in ios > build > Build > Products > GeneratedInfoPlistDotEnv.h

@fabriziomoscon
Copy link
Contributor

I wasted a couple of hours with this issue as well... using version 5.0.0 and RN 0.45.1
The app was building for all SCHEMES using a Build Settings Release but not for Debug.

I fixed by applying this patch to my ios/MyApp.xcodeproj/project.pbxproj

- ONLY_ACTIVE_ARCH = NO;
+ ONLY_ACTIVE_ARCH = YES;

- INFOPLIST_PREFIX_HEADER = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/GeneratedInfoPlistDotEnv.h";
+ INFOPLIST_PREFIX_HEADER = "${BUILD_DIR}/GeneratedInfoPlistDotEnv.h";

I really hope this could help somebody else not to waste time!

@linhnh123
Copy link

linhnh123 commented Jul 1, 2017

You can try, it work for me:
In Info.plist Preprocessor Prefix File:

${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

screen shot 2017-07-01 at 6 25 17 pm

Run command:
react-native run-ios
Then you must be close and reopen the XCode, clean and build.

@Knight704
Copy link

@xilibro thanks man, you saved my day!
All: in a nutshell the correct value for Preprocessor Prefix File is equal to ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

@mxkxf
Copy link

mxkxf commented Jul 15, 2017

Fixed this by opening ios/Project.xcodeproj and changing all occurences of:

INFOPLIST_PREFIX_HEADER = "${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h";

to:

INFOPLIST_PREFIX_HEADER = "${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h";

@yomybaby
Copy link

@mikefrancis, you save my time. 😄

@lanekatris
Copy link

@RyanMcDonald 's adding of the library worked for me. I had to do some manual steps:

  • Drag from node modules/react-native-config/ios/[xcode project file]
    image
  • To here in Xcode under "libraries"
    image
  • And add the library under "linked frameworks and libraries"
    image

My error went away yelling about the "GeneratedInfoPlistDotEnv.h" not existing.

@ifero
Copy link

ifero commented Feb 2, 2018

If some one of you is using cocoapods this solution, from @birkir, works perfectly:
#187 (comment)

@dancomanlive
Copy link

I just did the manual linking and I am getting React/RCTDefines.h' file not found.

"react": "^16.0.0-beta.5",
"react-native": "^0.52.2"

@salujaharkirat
Copy link

salujaharkirat commented Feb 19, 2018

If someone is facing this issue on a customised configuration(other than debug and release) you can try react-native-scheme-manager to handle the configurations. I have 3 configurations( debug, staging and release) now on iOS as I needed staging configuration for codepush. I was facing same issue until I used react-native-scheme-manager. This package modifies all your node_modules dependencies(.xproject) files based on configuration.

@evanjmg
Copy link

evanjmg commented Apr 29, 2019

Whenever you add a new target you either need to add manually or if you use cocoapods, make sure it gets added to the target their in your Podfile

@moroz0v
Copy link

moroz0v commented Jul 3, 2019

I install the latest version, and i found difference between README.md and web page
In README.md:

  • Set Info.plist Preprocessor Prefix File to ${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h

on web page:
Set Info.plist Preprocessor Prefix File to
${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

After i change my config as in READEME.md , it works well

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

@ankitsehgal94
Copy link

@RyanMcDonald 's adding of the library worked for me. I had to do some manual steps:

  • Drag from node modules/react-native-config/ios/[xcode project file]
    image
  • To here in Xcode under "libraries"
    image
  • And add the library under "linked frameworks and libraries"
    image

My error went away yelling about the "GeneratedInfoPlistDotEnv.h" not existing.

This is giving me linkers error.

@Shweta-Porwal
Copy link

I got this error when I forgot to run npm install inside my react native project before building the app. Steps followed : Went to react native project folder. Ran npm install from the Terminal. Restarted Xcode.Everything started working.

@harrisrobin
Copy link

harrisrobin commented Aug 29, 2019

Adding the following to my Podfile after deleting ios/Pods did it for me:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    
    # Because: https://github.com/luggit/react-native-config/issues/365
    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
      phase.shell_script = "cd ../../"\
      " && RNC_ROOT=./node_modules/react-native-config/"\
      " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
      " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"
      
      target.build_phases << phase
      target.build_phases.move(phase,0)
    end
 
  end
end

@sandeep-sethia
Copy link

@xilibro thanks man, you saved my day!
All: in a nutshell the correct value for Preprocessor Prefix File is equal to ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h

Didn't work for me. :(

@mehdihz
Copy link

mehdihz commented Sep 25, 2019

I've changed the below configs in "Build Settings" of project

  1. Info.plist Other Preprocessor Flags => -traditional
  2. Info.plist Preprocessor Prefix File => ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h
  3. Preprocess Info.plist File => Yes

and it worked

@ghost
Copy link

ghost commented Oct 9, 2019

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
Copy link

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:
#414 (comment)

@Taylor123
Copy link
Contributor

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

@denisdimitrov
Copy link

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

  • GeneratedInfoPlistDotEnv.h' file not found

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
Copy link

tpucci commented Jan 8, 2020

@nicolashemonic Perhaps this will help: #391 (comment)

@mechazod
Copy link

mechazod commented Apr 7, 2020

@denisdimitrov Just followed your suggestion.

@rafaelmaeuer
Copy link
Contributor

#391 (comment) describes how to generate the file, so it should give the right hint for anyone who needs to remove it.

@ElliDy
Copy link

ElliDy commented May 27, 2020

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
Copy link
Contributor

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
Copy link

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
Copy link

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
Copy link
Author

deno028 commented Jun 24, 2022

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

@deno028 deno028 closed this as completed Jun 24, 2022
@spsaucier
Copy link

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
Copy link

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests