ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

bug: Command failed with exit code 2 You may not have the required environment or OS to build this project

Open adamdbradley opened this issue 11 years ago • 87 comments

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

adamdbradley avatar Mar 04 '15 17:03 adamdbradley

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.

zulhfreelancer avatar Mar 14 '16 00:03 zulhfreelancer

i got error buil qq d faild

srjahir32 avatar Oct 20 '16 11:10 srjahir32

cordova platform update ios solved the issue on macbook

nhatdao2412 avatar Feb 01 '17 18:02 nhatdao2412

I don't think the problem is fully understood. None of it worked, is getting more confusing.

offwork avatar May 06 '17 13:05 offwork

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

Mr-m0dy avatar Aug 24 '17 00:08 Mr-m0dy

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 avatar Sep 05 '17 13:09 sojimon

@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

imhoffd avatar Sep 05 '17 15:09 imhoffd