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.

NODE_ENV and PORT not set

See original GitHub issue

logger.debug('Node env: ', process.env.NODE_ENV) output is blank.

Why is that?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Timercommented, Jul 19, 2017

This is not related to create-react-app; if you’d like to use NODE_ENV in your server code you must explicitly define it:

"server": "NODE_ENV=development babel-watch server/index.js",
0reactions
Timercommented, Jul 19, 2017

It is, but you are not using CRA. You’ve built your own server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is process.env.PORT in Node.js? - Stack Overflow
If you are using this in windows machine, first you'll have to set the PORT variable as "set PORT=3300", then in the next...
Read more >
Webpack 2: -p option does not set NODE_ENV to "production ...
It will not set the node environment variable process.env.NODE_ENV in your webpack config, as the webpack config is run directly by node.
Read more >
Working with Environment Variables in Node.js - Twilio
This opens up an array of ways to configure different aspects of your Node.js application. So while hosts will set a PORT variable...
Read more >
Using Environment Variables in Node.js for App Configuration ...
Set the NODE_ENV environment variable to "development" , enabling debug mode in your development environment; Provide environment-specific ...
Read more >
How to Easily Set-up Node Config (Best Practices)
We will make the app aware of the currently set environment. In Node, the NODE_ENV variable is used for this. Commonly used environments...
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