lugg / react-native-config

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

Unable to run ENVFILE= command #549

Open Jacob-Finn opened 3 years ago

Jacob-Finn commented 3 years ago

Description

Been having issues with the following command not appropriately changing my env: ENVFILE=.env.staging react-native run-ios

Versions

I have also tested the following with the same results:

react-native-info

System:
    OS: macOS 10.15.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 310.65 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.15.0 - ~/.nvm/versions/node/v12.15.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.15.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /Users/<snip>/.rvm/rubies/ruby-2.5.0/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 12.2/12B45b - /usr/bin/xcodebuild
  Languages:
    Java: 12.0.2 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Setup

I have tried creating a new react-native project and adding the following:

const App = () => {
  return (
    <>
      <SafeAreaView>
        <Text>{Config.displayString}</Text>
      </SafeAreaView>
    </>
  );
};
export default App;

.env displayString="Hello"

.env.dev displayString="Hello Dev"

.env.staging displayString="Hello Staging"

Expected Behavior

Actual Behavior

sharmapr25 commented 3 years ago

@Jacob-Finn I have mentioned this issue in this comment. https://github.com/luggit/react-native-config/issues/522#issuecomment-749432089 👍

Jacob-Finn commented 3 years ago

@Jacob-Finn I have mentioned this issue in this comment. #522 (comment) 👍

Thanks! I checked out your comment and downloaded the package you provided and it worked perfectly. I'll leave my issue open until this is resolved in the main repo, but thanks a lot! Anyone else facing the same issue please look at the link @sharmapr25 has provided.

aless10 commented 3 years ago

Hi, the #522 works for ios, but I still facing issues with android. I have react native 0.63 and react-native-config 1.4.2 Do I need to follow the android manual installation? Thanks.