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 - npm should be run with the --production flag by default to exclude devDependencies
Summary: npm should be run with the --production flag by default to exclude devDepende...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Michal Fojtik
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-07 15:07 UTC by Mike Finkenzeller
Modified: 2015-05-15 00:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-26 19:11:30 UTC
Target Upstream Version:


Attachments (Terms of Use)

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!


Note You need to log in before you can comment on or make changes to this bug.