安装 PhoneGap,执行命令“ant"时出错 [英] Installing PhoneGap, error executing command 'ant'

查看:24
本文介绍了安装 PhoneGap,执行命令“ant"时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过 nodeJS 安装 PhoneGap 时,我在尝试运行我的应用程序时遇到错误(安装 phonegap 并创建应用程序有效):

When installing PhoneGap via nodeJS i got an error when trying to run my app (installing phonegap and creating the app worked):

C:\Users\arko\my-app>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
    [error] An error occured during creation of android sub-project.

C:\Users\arko\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
                throw e;
                      ^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
    at C:\Users\arko\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:47
:27
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)

所以我注意到我从未安装过 ANT,所以我安装了.我跟着这个教程:http://cleancodedevelopment-qualityseal.blogspot.nl/2012/11/how-to-install-phonegap-for-android.html 并完成它所说的一切.

So I noticed I never had ANT installed, so I did. I followed this tutorial: http://cleancodedevelopment-qualityseal.blogspot.nl/2012/11/how-to-install-phonegap-for-android.html and done everything it said.

它说你必须向 Path 变量添加内容的部分,它说只需添加: %ANT_HOME%\bin;但是我的路径以这个结尾:C:\Program Files\Windows Live\Shared - 所以我添加了这个:;%ANT_HOME%\bin;

The part it says you have to add stuff to the Path variable, it said just add this: %ANT_HOME%\bin; however my Path ended with this: C:\Program Files\Windows Live\Shared - so I added this to it: ;%ANT_HOME%\bin;

尝试再次运行 android 应用程序,并得到相同的错误.我用这个命令运行它:

Tried to run the android app again, and got the same error. I ran it with this command:

phonegap run android

我做错了什么?

谢谢!

推荐答案

可能你有一个新版本的cordova,我看到在伙伴机器上安装了cordova 3.5.0版,而在我的机器上安装了3.4.0版本,可能是ant版本与cordova新版本不兼容(他和我用的是1.9.4的ant版本).

Probably you have a new version of cordova, i saw that in a partner machine was installed the cordova version 3.5.0 and in my machine it was installed the 3.4.0 version, maybe the ant version is incompatible with the new version of cordova (He and i has the ant version 1.9.4) .

尝试在 node.js 控制台中使用此命令安装旧版本的cordova:

Try install a old version of cordova with this command in the node.js console:

    npm install -g cordova@3.4.0-0.1.0 

并再次运行命令.

其他原因:验证您的路径变量配置是否正确..

Other cause: Verify that your Path Variables are configured correctly..

我的英语不是很好,但我希望能帮助你解决问题.

My english is not pretty good, but i hope help you to solve the problem.

这篇关于安装 PhoneGap,执行命令“ant"时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆