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
Lioness100
Lioness10016mo ago
.env doesn't allow setting NODE_ENV
@noxillio What do you mean?
Lioness100
Lioness10016mo ago
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...
Lioness100
Lioness10016mo ago
Look at the question for how to do it in non-windows, and the answers for how to do it with windows.
Noxillio
Noxillio16mo ago
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
Lioness100
Lioness10016mo ago
Could you link whatever source you found?
Noxillio
Noxillio16mo ago
Stack Overflow
How to set NODE_ENV to production/development in OS X
For use in express.js environments. Any suggestions?
Noxillio
Noxillio16mo ago
Meanwhile I check the GitHub repo and supposedly it is supposed to work But it didn’t for me
Lioness100
Lioness10016mo ago
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?
Noxillio
Noxillio16mo ago
Noxillio
Noxillio16mo ago
My token and owner IDs
Lioness100
Lioness10016mo ago
This is if NODE_ENV was already set by something else Either way, this should work.
Noxillio
Noxillio16mo ago
@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.png
Imgur
Noxillio
Noxillio16mo ago
Will 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 now
Favna
Favna16mo ago
Maybe you set NODE_ENV in your shell rc file or something on your system which is why it's set already?
Want results from more Discord servers?
Add your server