question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question : Is it possible to run `npm start env.arbitrary`

See original GitHub issue

I have multiple env. variables set in different files (external services keys etc…), and I’d like to run the app in development mode with each environment variable easily… Something like

npm start env.demo
npm start env.staging
npm start env.production 
... etc 

Is it currently possible with the CRA setup?

Thank you 🙏

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
Timercommented, May 24, 2018

I suspect the format might be to blame.

Can you try just uh:

MAILCHIMP_KEY=KEY
REACT_APP_API_URL=URL
REACT_APP_ENV=demo

Also, make sure these variables aren’t set in your shell already. Please open a new issue if you have a problem still!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using environment variables in npm scripts across platforms
I am building a package.json and use ...
Read more >
npm-run-script
Description. This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts.
Read more >
Utilizing npm Scripts During Development
One of the most useful ways to utilize npm scripts is to alter the value of Node's Node_ENV variable which is accessible in...
Read more >
Three Things You Didn't Know You Could Do with npm ...
When you run a command or script through npm run... , your environment variables will automatically be augmented with a set of variables...
Read more >
Using environment variables in a React application
Keep in mind that when building the application by running npm build , these variables will be embedded in the build so don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found