Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
npm run demo doesn't pointing to demo

I have two different environments with named .env.development, .env.production, and common .env also.

.env.development looks like this,

TEST_LABEL=Development

.env.production looks like this,

TEST_LABEL=Production

.env looks like this,

TEST_LABEL=ENV

And here is my babel.config.js,

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: [
      ["module:react-native-dotenv",
        {
          "moduleName": "@env"
        },]
    ]
  };
};

this is the scripts in package.json

"scripts": {
    "start": "react-native start",
    "development": "NODE_ENV=development expo start",
    "production": "NODE_ENV=production expo start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest"
},

And this is how I used it in my Homescreen.js

import {TEST_LABEL} from "@env"
...
<Text>{TEST_LABEL}</Text>

And this displays always Development even I run the production env

I run the app like npm run development for development environment, npm run production for production environment.

I am using react-native-dotenv

Here is the Project structure snapshot,

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found this issue and it says the only supported envs are development, production, and test. If you want to use other env names you can use the experimental feature APP_ENV

    "demo": "APP_ENV=demo expo start",
    "local": "APP_ENV=local expo start",

and I think .local files are loaded by default

UDPATE

I tested your config and it looks like this issue is the reason the value is not updating, adding -c to your commands clears the cache and load the correct env values

    "development": "NODE_ENV=development expo start -c",
    "production": "NODE_ENV=production expo start -c",
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!