2

我正在尝试构建一个混合应用程序,大约一个小时前我使用相同的环境构建了应用程序,但现在我无法为任何平台构建应用程序。科尔多瓦给了我以下错误

D:\xampp\htdocs\applications\quadBuild>phonegap build android
[phonegap] executing 'cordova build android'...


D:\xampp\htdocs\applications\quadBuild>cordova build android
Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char:
    at error (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova\node_m
odules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:347:8)
    at strictFail (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova\n
ode_modules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:364
:22)
    at Object.write (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova
\node_modules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:6
03:11)
    at XMLParser.feed (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordo
va\node_modules\cordova-lib\node_modules\elementtree\lib\parsers\sax.js:48:15)
    at ElementTree.parse (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\node_modules\elementtree\lib\elementtree.js:263:1
0)
    at Object.exports.XML (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\node_modules\elementtree\lib\elementtree.js:593:
13)
    at Object.module.exports.parseElementtreeSync (C:\Users\Spartan 7\AppData\Ro
aming\npm\node_modules\cordova\node_modules\cordova-lib\src\util\xml-helpers.js:
123:38)
    at ConfigFile_load [as load] (C:\Users\Spartan 7\AppData\Roaming\npm\node_mo
dules\cordova\node_modules\cordova-lib\src\plugman\util\ConfigFile.js:69:33)
    at new ConfigFile (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordo
va\node_modules\cordova-lib\src\plugman\util\ConfigFile.js:48:10)
    at ConfigKeeper_get [as get] (C:\Users\Spartan 7\AppData\Roaming\npm\node_mo
dules\cordova\node_modules\cordova-lib\src\plugman\util\ConfigKeeper.js:51:23)

这是在重新启动后发生的。可能是什么问题呢?请帮我。

4

1 回答 1

0

您是否考虑过从您的 XML 数据中删除 Windows 系统自动添加到 utf-8 文件的字节顺序标记字符?

在传递要解析的 xml 值之前,请尝试删除该字符:

var cleanedXML = origXML.replace("\ufeff", "");

来源: http: //www.multiasking.com/blog/xml2js-sax-js-non-whitespace-before-first-tag/

于 2016-05-28T17:18:53.990 回答