stradosphere stradosphere - 13 days ago 9
Android Question

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.

Answer

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.