React-native-config: 'ENVFILE' is not recognized as an internal or external command, operable program or batch file.

Created on 26 May 2017  路  4Comments  路  Source: luggit/react-native-config

After installing and linking the library, and adding the apply to the build.gradle, i'm trying to run 'ENVFILE=.env.dev react-native run-android' and getting that error. Anyone else seen this??

Most helpful comment

If you are using powershell:
$env:ENVFILE="name.of.file"; react-native run-android

If you are using regular cmd:
SET ENVFILE = 'name.of.file' && react-native run-android

Good Luck!

All 4 comments

ENVFILE=.env.dev

This is a command that creates/sets the variable ENVFILE to the value .env.dev before running the react build.

It does not work on Windows.

You can try the windows command set and setx to set environment variables I did not have much success doing that and having react-native-config take that value into account.

I'm reading this lib source code now to try to see why the system variable is not being used, If someone has insight feel free to help.

If you are using powershell:
$env:ENVFILE="name.of.file"; react-native run-android

If you are using regular cmd:
SET ENVFILE = 'name.of.file' && react-native run-android

Good Luck!

:+1:! @ofirgeller nailed it, thank you!

This should be clearer in the latest readme.

For anyone using Git Bash:

set ENVFILE='name.of.file' && react-native run-android
Was this page helpful?
0 / 5 - 0 ratings