Production mode?
I'm having issues disabling the
DEVELOPMENT MODE
.
.env
doesn't allow setting NODE_ENV
and it doesn't work based on the name of the .env
file. I've also tried using MODE
per a Stack Overflow thread I found but that didn't work either. Is there not a solution where I just copy the built files over and change a setting somewhere?14 Replies
.env doesn't allow setting NODE_ENV@noxillio What do you mean?
Anyways, follow this thread for setting NODE_ENV when running the node command https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows
Stack Overflow
How can I set NODE_ENV=production on Windows?
In Ubuntu it's quite simple; I can run the application using:
$ NODE_ENV=production node myapp/app.js
However, this doesn't work on Windows. Is there a configuration file where I can set the attr...
Look at the question for how to do it in non-windows, and the answers for how to do it with windows.
I mean when you put NODE_ENV into a .env it doesn’t work, and I confirmed that by looking it up
Will try a command instead when I’m back on PC though
Thank you
Could you link whatever source you found?
Stack Overflow
How to set NODE_ENV to production/development in OS X
For use in express.js environments. Any suggestions?
Meanwhile I check the GitHub repo and supposedly it is supposed to work
But it didn’t for me
I don't see anywhere here where it says it doesn't work.
I assume you're using dotenv? Are other env variables working from .env?
My token and owner IDs
This is if NODE_ENV was already set by something else
Either way, this should work.
@lioness100 I was able to get it working with your help, thank you.
I ended up using
cross-env
to get the job done. Just updated my scripts to look like this: https://i.imgur.com/UWWl1TV.pngWill have to keep an eye on the
dev
part though to make sure it works the way I want. But yeah I'm good for nowMaybe you set NODE_ENV in your shell rc file or something on your system which is why it's set already?