最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Run mean stack app in production - Stack Overflow

programmeradmin0浏览0评论

I am just playing with MEAN stack but I can't figure out how to run my app in production mode to perform some benchmarking. Site mean.io says:

To run with a different environment, just specify NODE_ENV as you call grunt:

$ NODE_ENV=test grunt

How can I pass the variable to grunt?

Edit: I am using Windows

I am just playing with MEAN stack but I can't figure out how to run my app in production mode to perform some benchmarking. Site mean.io says:

To run with a different environment, just specify NODE_ENV as you call grunt:

$ NODE_ENV=test grunt

How can I pass the variable to grunt?

Edit: I am using Windows

Share Improve this question edited Nov 29, 2013 at 15:03 svobol13 asked Nov 29, 2013 at 13:32 svobol13svobol13 1,9603 gold badges26 silver badges43 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

To decide if the application runs in production or development mode, it checks the NODE_ENV environment variable, which is a variable that you'll set in your shell and that will be read from node.

If you want to run grunt in production mode, use:

$ NODE_ENV=production grunt

which will set the variable only for this execution.

If you want to permanently set NODE_ENV, use export:

$ export NODE_ENV=production
$ grunt

On your production server, you can then edit .bashrc with this line to permanently set NODE_ENV.

For further information, you can read this blog post.

Edit: On Windows, use set NODE_ENV=production on the mand line. See this relevant question to know how to permanently set this variable.

The following mand works in my case:

grunt prod

Notice that I use mean.js version 0.4.2 and found this config in file $HOME_PROJECT_FOLDER/gruntfile.js

发布评论

评论列表(0)

  1. 暂无评论