Sencha Command上的Cordova和PhoneGap初始化失败

时间:2014-03-08 17:27:17

标签: node.js ubuntu cordova sencha-touch

我在Ubuntu 13.10上通过NodeJS CLI安装了PhoneGap,并启动了本机构建过程。但是,在初始化期间,这是执行的命令和相应的输出。

    $ sencha phonegap init com.foo.barapp BarApp
    Sencha Cmd v4.0.2.67
    [INF] 
    [INF] sencha-phonegap-init:
    [INF] 
    [INF] init-phonegap:
    [INF]      [echo] Adding PhoneGap to Application
    [INF]      [echo] Adding PhoneGap template files
    [INF]      [echo] Adding Native properties
    [INF] [x-property-file] Updating property file: /tmp/BarApp/.sencha/app/native.properties
    [INF] [x-property-file] Updating property file: /tmp/BarApp/.sencha/app/build.properties
    [INF]      [echo] Patching build.xml for PhoneGap Support
    [INF]      [echo] Building PhoneGap App
    [ERR] The following error occurred while executing this line:
    /opt/sencha/cmd/4.0.2.67/extensions/cmd-phonegap-packager/cmd-phonegap-packager.plugin.xml:131: The following error occurred while executing this line:
    jar:file:/opt/sencha/cmd/4.0.2.67/sencha.jar!/com/sencha/ant/antlib.xml:608: shellscript returned: 1

同样的事情发生在Cordova身上。

2 个答案:

答案 0 :(得分:1)

我找到的解决方案是重新定义phonegap.js中设置的env值:

    $ git diff phonegap.js

    $ diff --git a/lib/node_modules/phonegap/bin/phonegap.js b/lib/node_modules/phonegap/bin/phonegap.js
    index b6e469b..e1eb83f 100755
    --- a/lib/node_modules/phonegap/bin/phonegap.js
    +++ b/lib/node_modules/phonegap/bin/phonegap.js
    @@ -1,4 +1,4 @@
    -#!/usr/bin/env node
    +#!/usr/bin/env nodejs

    /*!
     * Module dependencies.eplace the interpreted value set at phonegap.js file.

Cordova脚本也可以这样做。

答案 1 :(得分:1)

这有助于我在Ubuntu 13.10上使用Cordova。 要修复cordova(全球安装),只需编辑以下文件: / usr / local / lib / node_modules / cordova / bin / cordova

-#!/usr/bin/env node
+#!/usr/bin/env nodejs