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

I'm getting this too. Mac Yosemite. Is there a temporary workaround? I created a boilerplate blank project, added the android platform. Then got the following error after running "ionic build android"

" [Error: Please install Android target: "android-21". Hint: Open the SDK manager by running: /Users/me/Workspace/android-sdk-macosx/tools/android You will require:

  1. "SDK Platform" for android-21
  2. "Android SDK Platform-tools (latest)
  3. "Android SDK Build-tools" (latest)] ERROR building one of the platforms: Error: /www/whatever/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /www/whatever/platforms/android/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:110:17) at maybeClose (child_process.js:1008:16) at Process.ChildProcess._handle.onexit (child_process.js:1080:5) "

Then, I thought I'd be sneaky by modifying the properties to target the android-19 API, instead. But then I got...

" BUILD FAILED /Users/me/Workspace/android-sdk-macosx/tools/ant/build.xml:601: The following error occurred while executing this line: /Users/me/Workspace/android-sdk-macosx/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/me/Workspace/android-sdk-macosx/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 3 seconds

/www/whatever/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: ant with args: debug,-f,/www/whatever/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen ERROR building one of the platforms: Error: /www/whatever/platforms/android/cordova/build: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: /www/whatever/platforms/android/cordova/build: Command failed with exit code 1 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1008:16) at Process.ChildProcess._handle.onexit (child_process.js:1080:5) "

dano2 avatar Mar 12 '15 19:03 dano2

@dano2 - try running the android tools and installing the items below:

Open the SDK manager by running: /Users/me/Workspace/android-sdk-macosx/tools/android

You will require:

  1. "SDK Platform" for android-21
  2. "Android SDK Platform-tools (latest)
  3. "Android SDK Build-tools" (latest)]

jbavari avatar Mar 12 '15 21:03 jbavari

thanks jbavari. that did the trick. I'm kind of new to ionic. is it common for the starter app to not target the latest android api (which is 22 now)? Or is ionic still catching up?

Thanks.

dano2 avatar Mar 12 '15 21:03 dano2

Ionic only wraps up the specific platform environments. It's still up to you, the developer, to ensure you have the necessary dependencies to build the project.

We are trying to include the dependencies going forward, however, for now, the errors are pretty sufficient to tell you how to correct the issue.

jbavari avatar Mar 12 '15 21:03 jbavari

Getting a similar issue when trying to run on iOS. It may be a cordova plugin permissions issue, because I have to use sudo ionic run ios to get the following error message. I am using the most up to date version of Ionic CLI (1.3.16), Xcode 6.2, and iOS 8.1 -

I also refreshed my provisioning profiles with no luck. Any insight would be hugely appreciated. Thanks.

** BUILD FAILED ** The following build commands failed: Check dependencies (1 failure) ERROR running one or more of the platforms: Error: /Users/cpk2/Sites/amazingMobile/platforms/ios/cordova/run: Command failed with exit code 65 You may not have the required environment or OS to run this project

EDIT: I am able to run fine from Xcode when I set the .xcodeproj "iOS deployment taget" to iOS 8.1. I For some reason it was set to iOS 6.0.

ckahle33 avatar Mar 16 '15 18:03 ckahle33

I agree with the fact that, as developers using tools that were offered to us for free, we are in no place to complain about said software's ease of use. However, the original error on this thread is quite vague. I don't have the correct "OS or environment"? That is almost comically unhelpful. And, because it lumps together several errors under the same output, as I've searched for a solution, I've not come across the same solution to the problem twice.

brian-murphy avatar Mar 22 '15 14:03 brian-murphy

@brain-murphy I agree with you - that error response is not good at all. Luckily for us - this is open source and we are both welcome to go and change the code for the better.

It appears to come from the cordova-cli - what we would need to do then, is patch that code to properly check for versions.

To clarify for you now - there are three things you need to build ios applications on Mac:

XCode build - minimum version 4.6.0 ios-sim - min version 3.0.0 (npm install -g ios-sim) ios-deploy - min version 1.2.0 (npm install -g ios-deploy)

jbavari avatar Mar 22 '15 23:03 jbavari

It appears that the issue is with ios-deploy. I have cordova 4.3 and xcode 6.2. My previous version of ios-deploy was 1.3.2 and I updated it to 1.4.0.

It works and loads the app on the phone, however it doesn't just drop out like it used to. It stays connected to the phone and it seems to make the app freeze. I'm just using it to load test devices for QA so I can just disconnect it and restart the app so it's a minor inconvenience to me.

JeffreyJamesAttenti avatar Mar 23 '15 15:03 JeffreyJamesAttenti

I'm running into this now after updating to latest. I'm looking into it.

jbavari avatar Mar 23 '15 21:03 jbavari

Hi, I am getting this error as well on Yosemite. Any ideas as to what could cause this? Both android and ios builds result in the same error.

achaiah avatar Mar 24 '15 04:03 achaiah

i have same error on Yosemite & solved with cordova platform update android @ .meteor/local/cordova-build & ``cordova build android` again

hedcet avatar Mar 28 '15 17:03 hedcet

Updating android didn't help me with my problem. This, however, did work:

cordova platform remove android
cordova platform add android

mulderjoe avatar Mar 30 '15 18:03 mulderjoe

webView.canGoBack() error in crosswalk 11.40.277.7.1

http://pt.stackoverflow.com/questions/53282/plugin-de-splashcreen-cordova-e-%C3%ADcones-n%C3%A3o-funcionam-no-crosswalk

hedcet avatar Mar 31 '15 16:03 hedcet

Has anyone tried this with Windows10? What is the "Adding in default Ionic hooks" message?? (Never seen this before). It was working fine, so I expect that it was after I updated the ionic-cli.

cuznerdexter avatar Apr 01 '15 19:04 cuznerdexter

cordova platform update android worked for me, though I wasn't trying to build for iOs (yet). Thanks @HedCET !

TzipporahWitty avatar Apr 02 '15 07:04 TzipporahWitty

I am also having this problem with iOS.

ionic run ios --device  -OR-  cordova run ios --device
Command failed with exit code 2
You may not have the required environment or OS to run this project

ios-deploy 1.4.0 ios-sim 3.1.1 ionic 1.3.19 cordova 4.3.0 OS X Mavericks Xcode 6.1

Tyguy7 avatar Apr 03 '15 23:04 Tyguy7

I FIXED MINE!

I didn't notice that before the 'Command failed' error was another error:

AMDeviceInstallApplication failed: 0xE8008015: Your application failed code-signing checks. Check your certificates, provisioning profiles, and bundle ids.

I went to https://developer.apple.com/account/ios/profile/profileList.action and sure, enough, my provisioning profile was invalid. I created a new one, downloaded it, and double clicked (looks like xcode silently installed it)

After that everything deploys to my device without issue.

Tyguy7 avatar Apr 03 '15 23:04 Tyguy7

when I do a ionic build ios I see the following error

The following build commands failed: CompileXIB myApp/Classes/MainViewController.xib (1 failure) Error code 65 for command: xcodebuild with args: -xcconfig,/Users/arjunbadarinath/git/seed/myApp/platforms/ios/cordova/build-debug.xcconfig,-project,myApp.xcodeproj,ARCHS=i386,-target,myApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/arjunbadarinath/git/seed/myApp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/arjunbadarinath/git/seed/myApp/platforms/ios/build/sharedpch ERROR building one of the platforms: Error: /Users/arjunbadarinath/git/seed/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: /Users/arjunbadarinath/git/seed/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:110:17) at maybeClose (child_process.js:1008:16) at Process.ChildProcess._handle.onexit (child_process.js:1080:5)

I have xcode 5.0.2, also have installed ios-sim and ios-deploy

Please help.

arjunbadarinath avatar Apr 06 '15 02:04 arjunbadarinath

I had this same issue after needing to upgrade Cordova to support iOS 64-bit. I tried everything here. The thing that finally worked was mulderjoe's suggestion, but for ios:

sudo cordova platform remove ios sudo cordova platform add ios

Thanks, mulderjoe

islanddave avatar Apr 09 '15 17:04 islanddave

Just in case any of you guys are using cordova 4.3, I found a solution. In my case, I believe it was a bug that couldn't properly handle a case-sensitive file system in OSX. I downgraded to cordova 4.2 and it works fine. Looks like a fix will come out in the next release (fingers crossed).

achaiah avatar Apr 10 '15 01:04 achaiah