Stradosphere
Stradosphere

Reputation: 1285

ignore node_modules on cordova build

How can I stop cordova from trying to copy my www/node_modules folder to platforms/{android/iOS}/www the when doing a build command like this:

     cordova build android

This seems like a relatively straight forward thing that everybody would want to do, but everything I have found does not seem to work.

This is particularly an issue when doing a build for android as something in my node folder is causing the build to fail.

I am hoping there is a way to leverage the config.xml file for this.

Upvotes: 1

Views: 1644

Answers (2)

johnborges
johnborges

Reputation: 2533

Don't include node_modules in /www. It should be one level up. My guess is that you initialized your npm project from the incorrect directory.

Upvotes: 3

Simon Prickett
Simon Prickett

Reputation: 4148

Have your build process that needs node_modules for Grunt and Bower run in some other folder in your project, one that is at the same level in the folder hierarchy as www perhaps. Then at the end of your build process, have the build tools copy the built artifacts into www before kicking off cordova build <platform name>.

Upvotes: 2

Related Questions