Windows 7 OS trying to build hybrid Android app

I am trying build my ionic project into a hybrid Android app but I keep getting “Command failed with exit code 2…” when I execute ionic build android

NOTE that I did not have this problem before

C:\Users\gecasti\Documents\GitHub\MTMobile>ls -l
total 367
-rw-r–r-- 1 gecasti Administ 4624 Apr 10 17:51 README.md
-rw-r–r-- 1 gecasti Administ 132 Apr 10 17:51 bower.json
-rw-r–r-- 1 gecasti Administ 6681 Apr 10 17:51 config.xml
-rw-r–r-- 1 gecasti Administ 1403 Apr 10 17:51 gulpfile.js
drwxr-xr-x 9 gecasti Administ 4096 Apr 10 17:51 hooks
-rw-r–r-- 1 gecasti Administ 90 Apr 10 17:51 ionic.project
-rw-r–r-- 1 gecasti Administ 721180 Apr 10 17:51 log.txt
-rw-r–r-- 1 gecasti Administ 671 Apr 15 14:33 package.json
drwxr-xr-x 4 gecasti Administ 0 Apr 15 14:31 platforms
drwxr-xr-x 13 gecasti Administ 4096 Apr 15 14:33 plugins
drwxr-xr-x 4 gecasti Administ 0 Apr 10 17:51 resources
drwxr-xr-x 3 gecasti Administ 0 Apr 10 17:51 scss
drwxr-xr-x 14 gecasti Administ 4096 Apr 10 17:51 www

C:\Users\gecasti\Documents\GitHub\MTMobile>java -version
java version "1.7.0_75"
Java™ SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot™ 64-Bit Server VM (build 24.75-b04, mixed mode)

C:\Users\gecasti\Documents\GitHub\MTMobile>ionic platform add android
running cordova platform add android
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\before_platform_add\init_directories.js C:\Users\gecasti\Do
cuments\GitHub\MTMobile
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.mote.mobile
Name: Mote
Android target: android-21
Copying template files…
Project successfully created.
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_prepare\010_add_platform_class.js C:\Users\gecasti\Do
cuments\GitHub\MTMobile
add to body class: platform-android
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_prepare\020_remove_sass_from_platforms.js C:\Users\ge
casti\Documents\GitHub\MTMobile
Plugin “com.ionic.keyboard” already installed on android.
Plugin “org.apache.cordova.camera” already installed on android.
Plugin “org.apache.cordova.console” already installed on android.
Plugin “org.apache.cordova.device” already installed on android.
Plugin “org.apache.cordova.file” already installed on android.
Plugin “org.apache.cordova.file-transfer” already installed on android.
Plugin “org.apache.cordova.inappbrowser” already installed on android.
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_platform_add\010_install_plugins.js C:\Users\gecasti
Documents\GitHub\MTMobile
Fetching plugin “org.apache.cordova.camera” via plugin registry

Fetching plugin “org.apache.cordova.console” via plugin registry

Fetching plugin “com.ionic.keyboard” via plugin registry

Fetching plugin “org.apache.cordova.device” via plugin registry

Fetching plugin “org.apache.cordova.file” via plugin registry

Fetching plugin “org.apache.cordova.inappbrowser” via plugin registry

Fetching plugin “org.apache.cordova.file-transfer” via plugin registry
Plugin “org.apache.cordova.file-transfer” already installed on android.
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_plugin_add\010_register_plugin.js C:\Users\gecasti\Do
cuments\GitHub\MTMobile

Saving platform to package.json file

C:\Users\gecasti\Documents\GitHub\MTMobile>ionic build android
running cordova build android
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_prepare\010_add_platform_class.js C:\Users\gecasti\Do
cuments\GitHub\MTMobile
add to body class: platform-android
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\gecasti\Documents\G
itHub\MTMobile\hooks\after_prepare\020_remove_sass_from_platforms.js C:\Users\ge
casti\Documents\GitHub\MTMobile
Running command: C:\Users\gecasti\Documents\GitHub\MTMobile\platforms\android\co
rdova\build.bat
ERROR building one of the platforms: Error: C:\Users\gecasti\Documents\GitHub\MT
Mobile\platforms\android\cordova\build.bat: Command failed with exit code 2
You may not have the required environment or OS to build this project

C:\Users\gecasti\Documents\GitHub\MTMobile>

C:\Users\gecasti\Documents\GitHub\MTMobile>ionic info

Your system information:

OS: Windows 7 SP1
Node Version: v0.10.28
Cordova CLI: 4.3.0
Ionic Version: 1.0.0-beta.13
Ionic CLI Version: 1.3.19

Please update your Node runtime to version >= >=0.10.33

C:\Users\gecasti\Documents\GitHub\MTMobile>
C:\Users\gecasti\Documents\GitHub\MTMobile>npm -version
1.4.9

C:\Users\gecasti\Documents\GitHub\MTMobile>

My Nodejs version is 1.4.9, I am not sure what does ionic info mean when it says that I need to update Node runtime to version 0.10.33 Could this be cause of my problem

What is Node version: v0.10.28?

Would ionic and cordova work with Node version 0.12.2?

Thanks,
Gibran

I work with Node 0.12.0 and all fine for me

1 Like

npm is the package manager, not the nodejs. To get the nodejs version you must type : node -v . (ionic info shows correctly)

1 Like

Thank you everyone for your input. I updated Nodejs to 0.12.2 and then I updated cordova and ionic to latest version for Windows 7 and everything is working now.