Reputation: 47635
This is my 2nd day at trying to install PhoneGap, so please go easy on me. Here's what I did starting this morning:
C:\Users\Phillip> npm install -g phonegap
C:\Users\Phillip> phonegap create my-app
C:\Users\Phillip> cd my-app
C:\Users\Phillip\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\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js
:87:29
at _rejected (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_m
odules\q\q.js:808:24)
at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.
js:834:30
at Promise.when (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\nod
e_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\Phillip\.cordova\lib\android\co
rdova\3.3.0\bin\node_modules\q\q.js:752:41)
at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.
js:574:44
at flush (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modul
es\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Edit 1:
C:\Users\Phillip\my-app>phonegap platform add android
[error] 'platform add android' is not a node C:\Users\Phillip\AppData\Roaming
\npm\node_modules\phonegap\bin\phonegap.js command. See 'node C:\Users\Phillip\A
ppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js help'
Edit 2:
C:\Users\Phillip\my-app>%userprofile%\.cordova\lib\android\cordova\3.3.0\bin\che
ck_reqs.bat
[Error: An error occurred while listing Android targets]
Edit 3:
C:\Users\Phillip\my-app>npm install -g cordova
Edit 4:
C:\Users\Phillip>cordova create hello com.example.hello HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.hello"
at location "C:\Users\Phillip\hello"
Downloading cordova library for www...
Download complete
C:\Users\Phillip>cd hello
C:\Users\Phillip\hello>cordova platform add ios
Downloading cordova library for ios...
Download complete
Creating ios project...
'C:\Users\Phillip\.cordova\lib\ios\cordova\3.4.0\bin\create' is not recognized a
s an internal or external command,
operable program or batch file.
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\Phillip\AppData\Roaming\npm\node_modules\
cordova\src\superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Upvotes: 14
Views: 13795
Reputation: 1368
Check if this blog helps you with the proper installation and check all the steps described are followed. Installing cordova phonegap
Upvotes: 1
Reputation: 747
Add your platform and build it first
npm install -g phonegap
phonegap create my-app
cd my-app
phonegap platform add android
phonegap platform build android
phonegap run android
And maybe use your cmd.exe in administrator mode. I lose so much time because of this..
Upvotes: 9
Reputation: 111
I have done this using the following commands:-
$ sudo npm install -g phonegap
$ phonegap create my-app
$ export PATH=${PATH}:/Users/taruna/Documents/adt-bundle-mac-x86_64-20131030/sdk/platform-tools:/Users/taruna/Documents/adt-bundle-mac-x86_64-20131030/sdk/toolssource
The above path should be your sdk tool path.
$ phonegap run android after
Now the above command will run your application in the emulator.It may take several minutes, so please wait for that and check the result.
Also, you should have node.js installed in your system before making any phonegap project using CLI.
Upvotes: 1
Reputation: 11721
Check you have all the requirements listed in the cordova platform guide
I recently discovered a magic command that helps display what's missing to build cordova android project :
%userprofile%\.cordova\lib\android\cordova\3.3.0\bin\check_reqs.bat
Upvotes: 2