I am new to react and setting up environment variables for my project. Here is what I did..
added .env-cmdrc.json as follows
{ "development":{ "REACT_APP_BASE_URL": "https://servername:port/" }, "staging":{ "REACT_APP_BASE_URL": "http://servername:port/" }, "local":{ "REACT_APP_BASE_URL": "http://localhost:port/" } }
installed npm
npm install env-cmd or npm install -g env-cmd
edited package.json as follows:
"start:development": "env-cmd -e development react-scripts start", "start:staging": "env-cmd -e staging react-scripts start", "start:local": "env-cmd -e local react-scripts start", "build:development": "env-cmd -e development react-scripts build", "build:staging": "env-cmd -e staging react-scripts build",
tried - npm run start:development
was giving me env-cmd error
again ran
npm install env-cmd
Now tried - npm run start:development
Failed to find .rc file at default paths: [./.env-cmdrc,./.env-cmdrc.js,./.env-cmdrc.json] at getRCFile
I am doing it first time and would appreciate any help..what am I missing here..