如何在Windows上设置NODE_ENV = production? [英] How can I set NODE_ENV=production on Windows?

查看:957
本文介绍了如何在Windows上设置NODE_ENV = production?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu中它很简单;我可以使用以下方式运行应用程序:

  $ 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆