Closed thedevdavid closed 4 years ago
Thanks to my colleague who found this magical commit which works perfectly. No workaround needed!
yarn add react-native-config@luggit/react-native-config#1eb6ac01991210ddad2989857359a0f6ee35d734
"react-native": "0.61.2"
This relates with a permission issue , executing sudo chmod -R 777 /path of the source will solve the issue :)
I had to adapt the post install script to make it working with RN 0.60.6 (and also to make it more Ruby style):
post_install do |installer|
installer.pods_project.targets.each do |target|
next unless target.name == 'react-native-config'
phase = target.project.new(
Xcodeproj::Project::Object::PBXShellScriptBuildPhase
)
phase.shell_script = <<-SCRIPT
cd ../../ && \
RNC_ROOT=./node_modules/react-native-config/ && \
export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig && \
export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig && \
ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby ${SRCROOT} ${SRCROOT}
SCRIPT
target.build_phases << phase
target.build_phases.move(phase, 0)
end
end
Adding the two ${SRCROOT}
in order to define the place where is the .env
file and where to build the GeneratedDotEnv.m
file fixed the script.
:+1: #349 has been merged/released with 0.12
@pedro can you have a look on https://github.com/luggit/react-native-config/issues/414 please? I can't make it work with rn 0.61 and 0.12
@zedtux I get error that .ruby file doesn’t exist. I have file on this path but it ends with .rb any idea?
@vvusts well then just replace .ruby
by .rb
😉
I was experiencing this issue when trying to build on AppCenter with RN0.61 and react-native-config 0.12.
I was using the helpful script posted by @zedtux (https://github.com/luggit/react-native-config/issues/187#issuecomment-551493446) to get around it.
I'm now running RN0.61.5, I've upgraded to react-native-config 1.0 and AppCenter now builds without a problem.
UPDATE 17th April 2020
I've started getting the following issue: Build input file cannot be found: GeneratedDotEnv.m
during local archive and during CI builds (on AppCenter). The only fix I can find is this (https://github.com/luggit/react-native-config/issues/391#issuecomment-571948199) but it's annoying because you have to update podspec whenever node_modules is re-built. Only fix which appeared to work consistently across local archiving and remote building/archiving.
I recently ran into this issue. Simply updating react-native-config
from 1.4.2 to 1.4.3 fixed the issue for me!
Clean xcode and rebuilding fixed it for me
Experiencing this occasionally on 1.4.11
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.
@chenop what do you mean by clean xcode
? I have a clean-all
task as follows, are there any other ghostly artifacts that need to be hunted down?
clean-all:
-rm ./package-lock.json
-rm -rf ./node_modules
-rm -rf ./ios/Pods
-rm -rf ./ios/Podfile.lock
-rm -fr $TMPDIR/metro-cache
-rm $TMPDIR/haste-map-*
@dcsan clean xcode means: Product --> Clean Build Folder
@dcsan clean xcode means: Product --> Clean Build Folder
Useful Hotkey for this is (Shift + Command + K) in XCode
This problem appears to be caused by the failure to find the .env
configuration file. I put the .env
file in the project and did the following action.
example
# Type a script or drag a script file from your workspace to insert its path.
PROD_FILE="${PROJECT_DIR}/../.env.production"
DEV_FILE="${PROJECT_DIR}/../.env.development"
if [ -f "$PROD_FILE" ]; then
cp "$PROD_FILE" "${PROJECT_DIR}/../.env"
else
cp "$DEV_FILE" "${PROJECT_DIR}/../.env"
fi
"${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildXCConfig.rb" "${SRCROOT}/.." "${SRCROOT}/tmp.xcconfig"
I had accidentally deleted my tmp.xcconfig from the ios folder
a quick cd ios && pod install && cd .. from the project root directory worked for me as that regenerates the file
might also clean XCode before running again (⌘Command + K )
Pod install again and error was gone.
If I use this package with Cocoapods and follow the README's instructions, the iOS build fails every time. With C Preprocessor error "'GeneratedDotEnv.m' file not found".
Without any pods, it works.
Does anybody have any experience with this? I'm stuck for 2 days now because of this issue. I can't find any solution. I tried a lot of things by now.