[SOLVED] Checking node_env in node.js

Issue

This Content is from Stack Overflow. Question asked by Dan Samborschi

enter image description here

enter image description here

Hello, I set the NODE_ENV in my dev env as development. When I console log the NODE_ENV it give me development, but when I do a compare it gives me false. Does anybody know what is it happening?



Solution

maybe you need to set the variable of NODE_ENV first.

like if you using windows

SET NODE_ENV=development

or Mac/linux

export NODE_ENV=development


This Question was asked in StackOverflow by Dan Samborschi and Answered by rizaldodo It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?