bug: Command failed with exit code 2 You may not have the required environment or OS to build this project
From @shivanshuit914 on March 3, 2015 19:15
Type: bug
Platform: desktop browser
> ionic build ios
ERROR building one of the platforms: Error: /Applications/MAMP/htdocs/myApp/platforms/ios/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /Applications/MAMP/htdocs/myApp/platforms/ios/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Process.ChildProcess._handle.onexit (child_process.js:823:5)
OS Mac Maverich, have followed this tutorial http://ionicframework.com/docs/guide/installation.html
Copied from original issue: driftyco/ionic#3225
This answer works for me.
ionic platform remove android
and then
ionic platform add android
Done!
Put sudo in front of ionic if it's failed.
i got error buil
d faild
cordova platform update ios solved the issue on macbook
I don't think the problem is fully understood. None of it worked, is getting more confusing.
This issue is fixed in the latest version of the “ios-sim” package (so now this is probably the easier solution - compared to the old one which is listed below). In order to update the “ios-sim” package to the latest version run this in your terminal/cmd:
cd platforms/ios/cordova/node_modules/ sudo npm install ios-sim@latest
I tried a lot to solve the following issue, on ionic cordova emulate android.
BUILD SUCCESSFUL
Total time: 9.815 secs
Built the following apk(s):
/var/www/taxi-driver-app/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=/home/ti/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386
Error: adb: Command failed with exit code 2 Error output:
/home/ti/Android/Sdk/platform-tools/adb: 1: /home/ti/Android/Sdk/platform-tools/adb: Syntax error: ")" unexpected
[ERROR] An error occurred while running cordova emulate android (exit code 1).
And on ionic info,
`cli packages: (/usr/local/lib/node_modules) @ionic/cli-utils : 1.9.2 ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 1.3.7
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.1.1
System:
Android SDK Tools : 26.0.2
Node : v7.4.0
npm : 4.0.5
OS : Linux 3.5`
@sojimon Sorry, I haven't personally had this issue with Cordova Android. Does this Stack Overflow issue help you? https://stackoverflow.com/questions/34216342/android-studio-adb-syntax-error-unexpected