1

Question 1:

I cloned latest mean.js package from the official Github repository, and went through the official document step by step. Now I am able to run the mean.js with grunt command on my machine. However, the application is running in development model. Even I run it with this command:

NODE_ENV=production grunt

Still, the output of this command is below (same as grunt only):

Specification Management - Development Environment
Environment:                        development
Port:                               3000
Database:                           mongodb://localhost/mean-dev
App version:                        0.0.1
MEAN.JS version:                    0.4.1

Does anybody know how to run it in production mode locally?

Question 2:

I deployed this application to heroku. I can tell from the log that the application runs in production mode. However, there is only a blank page, same as problem in this post: Blank page on Heroku - mean.js angular app. I followed the question by adding grunt build before run it, but it doesn't work.

Please help!

Community
  • 1
  • 1
Chong Tang
  • 2,066
  • 15
  • 12

2 Answers2

2

Answer 1: I have found the way to run an application in production mode. The command is

grunt prod

Answer 2: The official Mean.js repository added public/dist folder in .gitignore file. That's why the compiled JS files were not uploaded to Github, and so Heroku cannot get them from my repo. After delete the entry from .gitignore file, everything goes great.

Chong Tang
  • 2,066
  • 15
  • 12
0

Regarding Answer 2: I had this same issue. Your solution will work great, however if you have to deploy frequently (as I do), it becomes tiresome to remember to constantly rebuild your compiled JS files. Instead, you can set it up as a build script post install hook, which heroku will read as part of the normal build process. In this way, it can run the same minification grunt jobs on heroku itself. The way I've done it is fairly primitive - you could tidy it up and just run the JS minification, rather than the full build...but you get the idea. Modify package.json 'scripts' node with the following:

  "scripts": {
    "start": "grunt",
    "test": "grunt test",
    "postinstall": "bower install --config.interactive=false && grunt build"
  },
wanton
  • 98
  • 7