简体   繁体   English

忽略cordova构建上的node_modules

[英]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.

相关问题 资产和node_modules(Phonegap / Cordova) - assets and node_modules (Phonegap/Cordova) 使用Cordova的Ionic 3构建失败:cordova \\ node_modules \\ cordova-common \\ src \\ superspawn.js:169:23 - Ionic 3 BUILD FAILED with Cordova: cordova\node_modules\cordova-common\src\superspawn.js:169:23 Phonegap / Cordova构建android node_modules / q / q.js throw e; - Phonegap/Cordova build android node_modules/q/q.js throw e; Gulp Cordova构建android错误-node_modules-gulp-jscs-index.js:99:-RangeError:无效的字符串长度 - Gulp Cordova build android error - node_modules - gulp-jscs - index.js:99 :- RangeError: Invalid string length 在Ubuntu上安装Cordova会显示“…cordova / node_modules / q / q.js:126:错误 - Installation of Cordova on Ubuntu gives "…cordova/node_modules/q/q.js:126: error Cordova - 在构建时忽略文件夹 - Cordova - Ignore folders on build Cordova Build - 忽略文件 - Cordova Build - ignore files Gaxios._request 中的值无效 (/srv/node_modules/googleapis-common/node_modules/gaxios/build/src/gaxios.js:89:23) - Invalid Value at Gaxios._request (/srv/node_modules/googleapis-common/node_modules/gaxios/build/src/gaxios.js:89:23) 找不到模块 node_modules\@react-native-community\cli\build\bin.js' - Cannot find module node_modules\@react-native-community\cli\build\bin.js' 无法从“node_modules/expo/build/ExpoLazy.js”解析模块“./Linking/Linking” - Unable to resolve module `./Linking/Linking` from `node_modules/expo/build/ExpoLazy.js`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM