Issues with Ionic Command Line Tool?


#1

Hey all,

I am looking into reports of issues installing and creating new ionic projects with the ionic npm command line tool.

If you’ve had problems with it, please let me know below. I think some issues relate to having old versions of node or npm installed, but I’m also particularly interested in issues running the commands on Windows (including XP).

Thanks!


#2

Hi,
I am trying to install Ionic on Windows 8.
I have installed Git 1.9.2 and Node v0.10.28 under the ‘Program Files’ folder.

The following command ran without any errors/warnings:

npm install -g cordova

I then installed the cordova Android platform requirements, Java, Ant and added the path entries, etc.

When I run the following command:

npm install -g ionic

I get a warning as shown below (this may or may not be significant) but the command seems to complete:

npm WARN package.json github-url-from-git@1.1.1 No repository field.
C:\Users\graham\AppData\Roaming\npm\ionic -> C:\Users\graham\AppData\Roaming\npm\node_modules\ionic\
bin\ionic
ionic@1.0.11 C:\Users\graham\AppData\Roaming\npm\node_modules\ionic
├── connect-livereload@0.4.0
├── open@0.0.5
├── colors@0.6.2
├── ncp@0.4.2
├── q@1.0.1
├── shelljs@0.2.6
├── event-stream@3.0.20 (stream-combiner@0.0.4, duplexer@0.1.1, from@0.1.3, pause-stream@0.0.11, map
-stream@0.0.4, split@0.2.10, through@2.3.4)
├── optimist@0.6.0 (wordwrap@0.0.2, minimist@0.0.10)
├── form-data@0.1.2 (mime@1.2.11, async@0.2.10, combined-stream@0.0.4)
├── tiny-lr-fork@0.0.5 (debug@0.7.4, faye-websocket@0.4.4, noptify@0.0.3, qs@0.5.6)
├── unzip@0.1.9 (setimmediate@1.0.2, match-stream@0.0.2, readable-stream@1.0.27-1, pullstream@0.4.0,
 fstream@0.1.25, binary@0.3.0)
├── vinyl-fs@0.1.4 (graceful-fs@2.0.3, map-stream@0.1.0, mkdirp@0.3.5, vinyl@0.2.3, glob-stream@3.1.
9, glob-watcher@0.0.6)
├── request@2.27.0 (json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign@0.3.0, qs@0.6.6, tunnel
-agent@0.3.0, oauth-sign@0.3.0, cookie-jar@0.3.0, mime@1.2.11, node-uuid@1.4.1, hawk@1.0.0, http-sig
nature@0.10.0)
├── prompt@0.2.12 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.5, utile@0.2.1, winston@0.6.2)
├── archiver@0.5.1 (readable-stream@1.1.13-1, lazystream@0.1.0, zip-stream@0.1.4, lodash@2.4.1, file
-utils@0.1.5)
├── connect@2.17.1 (parseurl@1.0.1, response-time@1.0.0, cookie@0.1.2, pause@0.0.1, debug@0.8.1, coo
kie-signature@1.0.3, connect-timeout@1.1.0, fresh@0.2.2, vhost@1.0.0, on-headers@0.0.0, basic-auth-c
onnect@1.0.0, bytes@1.0.0, serve-favicon@2.0.0, errorhandler@1.0.1, morgan@1.1.1, cookie-parser@1.1.
0, qs@0.6.6, method-override@1.0.1, csurf@1.2.0, compression@1.0.2, express-session@1.2.0, type-is@1
.2.0, body-parser@1.2.0, serve-static@1.1.0, serve-index@1.0.3, multiparty@2.2.0)
└── npm@1.4.10

I then run:

ionic start TestTabs tabs

which seems to run ok and produces the following output:

C:\Users\graham\Documents\Ionic>ionic start TestTabs tabs
Running start task...
Creating Ionic app in folder C:\Users\graham\Documents\Ionic\TestTabs based on tabs project

DOWNLOADING: https://github.com/driftyco/ionic-app-base/archive/master.zip

DOWNLOADING: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
Initializing cordova project.
Fetching plugin "org.apache.cordova.device" via plugin registry
Fetching plugin "org.apache.cordova.console" via plugin registry
Fetching plugin "https://github.com/driftyco/ionic-plugins-keyboard" via git clone

After cd into the folder, I try to add the android platform but this fails with the following:

C:\Users\graham\Documents\Ionic>cd testtabs

C:\Users\graham\Documents\Ionic\TestTabs>ionic platform add android
Running platform task...
Adding platform android
Creating android project...

C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:87:29
    at _rejected (C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:808:24)

    at C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:834:30
    at Promise.when (C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:1079
:31)
    at Promise.promise.promiseDispatch (C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_
modules\q\q.js:752:41)
    at C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:574:44
    at flush (C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: C:\Users\graham\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command failed with exit c
ode 8
    at ChildProcess.whenDone (C:\Users\graham\AppData\Roaming\npm\node_modules\cordova\src\superspaw
n.js:126:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Unable to add platform android. Please see console for more info.

Not sure what is meant by “Please see console for more info.” ?

I would greatly appreciate any help with this.
Thanks
Graham


#3

Ok, I found that there was a problem with the path entries to the Android SDK.

The “ionic platform add android” command is working now.

Thanks


#4

I have problem with command line, ionic build android, as follows,

C:\dev\firstIonicApp>ionic build android
add to body class: platform-android
Running command: C:\dev\firstIonicApp\platforms\android\cordova\build.bat

C:\dev\firstIonicApp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error: ENOENT, no such file or directory 'C:\android\sdk\tools\tools\lib\build.t
emplate’
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at C:\dev\firstIonicApp\platforms\android\cordova\lib\build.js:93:40
at _fulfilled (C:\dev\firstIonicApp\platforms\android\cordova\node_modules\q
\q.js:798:54)
at self.promiseDispatch.done (C:\dev\firstIonicApp\platforms\android\cordova
\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\dev\firstIonicApp\platforms\android\c
ordova\node_modules\q\q.js:760:13)
at C:\dev\firstIonicApp\platforms\android\cordova\node_modules\q\q.js:574:44

at flush (C:\dev\firstIonicApp\platforms\android\cordova\node_modules\q\q.js

:108:17)
at process._tickCallback (node.js:415:13)
Error: C:\dev\firstIonicApp\platforms\android\cordova\build.bat: Command failed
with exit code 8
at ChildProcess.whenDone (C:\Users\Edgar\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135: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)


#5

Edgar, I am having the same problem did you ever find a solution to your issue?


#6

After upgrading the ANT as suggested in this forum, I still have the same error,

C:\Users\Edgar\todo>ionic platform add android
Creating android project…
Error: C:\Users\Edgar.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\c
reate: Command failed with exit code ENOENT
at ChildProcess.whenDone (C:\Users\Edgar\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)


#7

I have also a problem while adding android platform.

The test project that I have created in temp folder is working well in browser with “ionic serve” command.

But if I try to add the android platform, following error occurs:

C:\Temp\myapp1>ionic platform -add android
Adding in default Ionic hooks
Running command: “C:\Program Files\nodejs\node.exe” C:\Temp\myapp1\hooks\before_platform_add\init_directories.js C:\Temp\myapp1
Unable to fetch platform android: Error: Failed to parse json
Unexpected end of input

I tried to reinstall everything and check the environment path variable. Everything looks good but could not solve the problem.

Thanks for reply in advance


#8

I installed Node.js successfully.

Then in my command prompt I’m supposed to run “npm install -g cordova ionic”.
But I get this error:
‘npm’ is not recognized as an internal or external command, operable program or batch file.

Why is this happening? I have Windows 8.1 Single Language OS. Is it a problem with the OS? Help, please!