I am using create react app to bootstrap my app.
I have added two .env files .env.development and .env.production in the root.
.env
.env.development
.env.production
I was having the same problem, but it was because I had my .env file in YAML format instead of JS.
It was
REACT_APP_API_PATH: 'https://my.api.path'
but it needed to be
REACT_APP_API_PATH = 'https://my.api.path'