itaied
itaied

Reputation: 7107

How to disable openshift dependencies download for NodeJS?

I have set an openshift cartridge with NodeJS. In my package.json I have all the dependencies for my project, which npm installs in node_modules folder. I have added them to the .gitignore, but whenever I push the project, the openshift cartridge download all the dependencies.

How can I disable it?

I tried setting the environmental variable NPM_CONFIG_PRODUCTION to true as described here, but it didn't help.

Upvotes: 0

Views: 293

Answers (1)

João Gonçalves
João Gonçalves

Reputation: 4003

You can't disable the installation of dependencies, unless you don't declare them. If your project depends on certain libraries then openshift needs to install them as much as you do on your local machine.

This means that whenever you deploy your app to openshift the build process performs a npm install, which will make it install any missing dependencies to the node_modules folder.

Note that doing the opposite of what you are doing and track some dependencies on this folder (git add node_modules/mydep) will make your deployment process a bit faster.

Also: What NPM_CONFIG_PRODUCTION does is setting whether devDependencies are installed or not, this means that if you are using dependencies which are only local (for development) you should set them in your package.json file like so:

"devDependencies": {
    "webpack": "~1.0.0"
},

Upvotes: 3

Related Questions