Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1062639

Summary: npm should be run with the --production flag by default to exclude devDependencies
Product: OpenShift Online Reporter: Mike Finkenzeller <mike>
Component: ImageAssignee: Michal Fojtik <mfojtik>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: bmeng, mike
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-26 19:11:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Mike Finkenzeller 2014-02-07 15:07:36 UTC
When npm runs on the cartridge it is not using the --production flag

Thus devDependencies (like for Grunt.js) are being pulled down and eating up unnecessary disk space/quota

Comment 1 Michal Fojtik 2014-02-10 12:37:47 UTC
Hi Mike,

I found that you can also use the NODE_ENV environment variable[1] to say whether you want to run under production or not. In OpenShift you can use this command to switch to 'production'

$ rhc env set NODE_ENV="production" --app YOUR_APP

Then, when you do a full restart or git push, NodeJS should set the --production flag appropriately.

[1] https://npmjs.org/doc/misc/npm-config.html

Would this solution be an appropriate fix for this bug?

Comment 2 Meng Bo 2014-02-13 09:02:09 UTC
The node should run under production environment, move bug to verified.

Please feel free to reopen this if you still have problem.

Comment 3 Meng Bo 2014-02-13 09:46:40 UTC
(In reply to Meng Bo from comment #2)
> The node should run under production environment, move bug to verified.
> 
> Please feel free to reopen this if you still have problem.

The node should run under production environment after set the env NODE_ENV="production".

Comment 4 Mike Finkenzeller 2014-06-23 18:10:47 UTC
Yes. If I set the environment flag it runs in production mode. 

I would also think this should be the default for the cartridge. Just something for future thought. 

Thanks!