如何在Windows上设置NODE_ENV = production? [英] How can I set NODE_ENV=production on Windows?
问题描述
$ NODE_ENV =生产节点myapp / app.js
但是这不适用于Windows。有没有可以设置属性的配置文件?
尝试使用
set NODE_ENV = production
在您要运行Node.js应用程序的命令提示符下执行。
上述行将为执行命令的命令提示符设置环境变量NODE_ENV。
要全局设置环境变量,所以它们只能保留在单个命令提示符之外,您可以从控制面板中的系统中找到该工具(或者通过在搜索中输入environment开始菜单中的框)。
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 attribute?
Try to use
set NODE_ENV=production
This should be executed in the command prompt where you intend to run your Node.js application.
The above line would set the environment variable NODE_ENV for the command prompt where you execute the command.
To set environment variables globally so they persist beyond just the single command prompt, you can find the tool from System in Control Panel (or by typing 'environment' into the search box in the start menu).
这篇关于如何在Windows上设置NODE_ENV = production?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!