phonegap + Ubuntu 12.04 [英] phonegap + Ubuntu 12.04

查看:175
本文介绍了phonegap + Ubuntu 12.04的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让Phonegap在Ubuntu 12.04上运行。到目前为止,我已经成功地(好的)使用本指南安装它:
http:// perrymitchell.net/article/install_phonegap_ubuntu_12.04



我也添加了android sdk和PATH vars。



phonegap create命令成功,但是当运行phonegap run android或phonegap build android时,会出现以下情况:

  rok @ localhost:〜/ myapp $ phonegap运行android 
[phonegap]检测Android SDK环境...
[phonegap]使用远程环境

/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/common/config/global.js:45
fs.exists(filepath,function(exists){
^
TypeError:Object#< Object>没有方法存在
在Object.load(/ usr / local / lib / node_modules / phonegap / node_modules / phonegap-build / lib / common / config /global.js:45:8)
在PhoneGapBuild。< anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/login.js:60:19)
在PhoneGapBuild.login(/ usr / local / lib / node_modules / phonegap / node_modules / phonegap-build / lib / phonegap-build / login.js:47:13)
在PhoneGapBuild。< anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/build.js:60:10)
在PhoneGapBuild.build(/ usr / local / lib / node_modules /在RemoteBuildCommand.execute(/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build。)下的
。 js:74:19)
在RemoteBuildCommand.run(/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build.js:54:10)
在Object.build(/ usr / local / lib / node_modules / phonegap / lib / phonegap / util / command.js:28:25)
在RemoteRunCommand.execute(/ usr / local / lib / node_modules / phonegap / lib / phonegap / remote。 run.js:71:26)
在RemoteRunCommand.run(/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.run.js:54:10)

尝试运行此操作失败:

  rok @ localhost:〜/ myapp $ phonegap本地插件添加org.apache.cordova.core.console 
[phonegap]添加插件:org.apache.cordova.core.console
[错误]提取插件时出错:错误:连接ECONNREFUSED

我做错了什么

$ b为了回答我自己的问题,在使用phonegap成功运行hello world应用程序之前,还需要做两件事(不仅仅是在Ubuntu 12.04上)但我假设在任何平台上):


  1. 从CLI运行android命令并下载至少一个版本的SDK

  2. 运行android avd命令,并根据先前下载的SDK版本创建至少一个虚拟设备。

然后我可以在PhoneGap网站上描述的小小的hello应用程序上运行phonegap run android。


I'm trying to get Phonegap to work on Ubuntu 12.04. So far I've successfully (well kind of) installed it using this guide: http://perrymitchell.net/article/install_phonegap_ubuntu_12.04

I've also added the android sdk and the PATH vars.

The "phonegap create" command was successful, however when running the "phonegap run android" or the "phonegap build android" the following occurs:

rok@localhost:~/myapp$ phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the remote environment

/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/common/config/global.js:45
    fs.exists(filepath, function(exists) {
       ^
TypeError: Object #<Object> has no method 'exists'
    at Object.load (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/common/config/global.js:45:8)
    at PhoneGapBuild.<anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/login.js:60:19)
    at PhoneGapBuild.login (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/login.js:47:13)
    at PhoneGapBuild.<anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/build.js:60:10)
    at PhoneGapBuild.build (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/build.js:40:13)
    at RemoteBuildCommand.execute (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build.js:74:19)
    at RemoteBuildCommand.run (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build.js:54:10)
    at Object.build (/usr/local/lib/node_modules/phonegap/lib/phonegap/util/command.js:28:25)
    at RemoteRunCommand.execute (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.run.js:71:26)
    at RemoteRunCommand.run (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.run.js:54:10)

Trying to run this was not successful either:

rok@localhost:~/myapp$ phonegap local plugin add org.apache.cordova.core.console
[phonegap] adding the plugin: org.apache.cordova.core.console
   [error] Error fetching plugin: Error: connect ECONNREFUSED

What am I doing wrong

解决方案

To answer my own question, before one can successfully run a hello world app using phonegap, two more things need to be done (not just on Ubuntu 12.04 but I assume on any platform):

  1. run "android" command from the CLI and download at least one version of the SDK
  2. run "android avd" command and create at least one virtual device based on a version of a previously downloaded SDK.

Then I was able to run "phonegap run android" on the little hello app described on the PhoneGap's website.

这篇关于phonegap + Ubuntu 12.04的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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