简体   繁体   中英

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.

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.

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> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM