在OpenShift上运行npm install --production [英] Run npm install --production on OpenShift
问题描述
当我将代码推送到OpenShift时,似乎正在安装我的devDependencies
,这要花费永远.我真的很想对其进行设置,以便仅安装dependencies
(通过使用--production
标志运行).有什么办法吗?
When I push my code to OpenShift, it looks like it's installing my devDependencies
which takes forever. I would really love to set it up so it will only install the dependencies
(by running with the --production
flag). Is there any way to do this?
推荐答案
您可以通过将NPM_CONFIG_PRODUCTION
环境变量设置为"true
"来告诉npm使用--production
标志进行安装.
You can tell npm to install using the --production
flag by setting the NPM_CONFIG_PRODUCTION
environment variable to "true
".
以下是适用于现有应用程序的示例:
Here is an example that should work for existing applications:
rhc env set NPM_CONFIG_PRODUCTION="true"
或者,您可以将此变量设置为初始应用程序创建步骤的一部分:
Or, you can set this variable as a part of your initial app-create step:
rhc app create myapplication nodejs-0.10 NPM_CONFIG_PRODUCTION="true"
这篇关于在OpenShift上运行npm install --production的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!