在Eclipse中向Cordova App添加平台时出错

时间:2016-07-15 09:27:52

标签: node.js eclipse cordova hybrid-mobile-app

在我点击完成后在Eclipse(Mars)中创建一个新的Cordova项目后,它开始向我的应用程序添加平台,但最终抛出以下错误并且未添加平台:

X:\CordovaWorkspace\DemoProject>cordova prepare Discovered platform
"android@5.3.0-nightly.2016.7.6.103e1e8d" in config.xml. Adding it to
the project Adding android project... Running command: cmd "/s /c
"C:\Users\XYZ\.cordova\lib\android\cordova\5.3.0-nightly.2016.7.6.103e1e8d\bin\create.bat

X:\CordovaWorkspace\DemoProject\platforms\android demo.project "Demo
Project" --cli"" module.js:327
    throw err;
     ^

 Error: Cannot find module 'sax'
      at Function.Module._resolveFilename (module.js:325:15)
      at Function.Module._load (module.js:276:25)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.<anonymous> (C:\Users\XYZ\.cordova\lib\android\cordova\5.3.0-nightly.2016.7.6.103e1e8d\node_modules\elementtree\lib\parsers\sax.js:3:11)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)
 at Module.load (module.js:343:32)
 at Function.Module._load (module.js:300:12)
 at Module.require (module.js:353:17) Error: cmd: Command failed with exit code 1 Error: No platforms added to this project. Please use
 `cordova platform add <platform>`.

 X:\CordovaWorkspace\DemoProject>exit

enter image description here

如何解决。

1 个答案:

答案 0 :(得分:0)

尝试通过下载sax模块并将其放在名为sax的文件夹中手动解决sax要求。

或使用<a> 如果你没有在互联网上找到sax mmodule,你可以在你的node-elementtree / lib / parsers / sax.js中创建sax.js,并把这段代码放在下面:

npm install