[英]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尝试将www / node_modules文件夹复制到platform / {android / iOS} / www:
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. 在为Android进行构建时,这尤其是个问题,因为我的节点文件夹中的某些内容导致构建失败。
I am hoping there is a way to leverage the config.xml file for this. 我希望有一种方法可以利用config.xml文件。
Don't include node_modules in /www. 不要在/ www中包含node_modules。 It should be one level up.
它应该是一个级别。 My guess is that you initialized your npm project from the incorrect directory.
我的猜测是您从错误的目录初始化了npm项目。
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. 让需要Grunt和Bower的
node_modules
构建过程在项目的其他文件夹中运行,该文件夹可能与www
在文件夹层次结构中处于同一级别。 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>
. 然后,在构建过程结束时,让构建工具将构建的工件复制到
www
然后再开始cordova build <platform name>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.