Barış Akkurt
Barış Akkurt

Reputation: 2256

Cordova cannot add Android failed with exit code ENOENT

I am trying to create an Android project with Cordova, however i am getting an ENOENT error although i followed the tutorial step by step very carefully, this is getting me angry. First this is the screenshot of the error: enter image description here Here are information about my software and hardware/os:

Hardware and OS:

Software: Here are some of the outputs of my command line for the related software.

enter image description here

Here are some of my system variables:

Extra information with -d flag:

enter image description here

Update

I cleaned .cordova and reinstalled it and now, i am getting this error: enter image description here

My variables are defined as indicated above.

Upvotes: 6

Views: 33891

Answers (8)

Bhavikkumar
Bhavikkumar

Reputation: 446

I just run cmd with as Administrator and execute 'cordova platform add android' command and now work fine.

Upvotes: 0

suraj mahajan
suraj mahajan

Reputation: 870

If you are sure of yours paths try to type android in cmd if it says: 'xcopy' was not recognized.

then add to your path:

%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;

In certain cases, don't forget to reboot the PC.

Upvotes: 8

SuperTed
SuperTed

Reputation: 321

I had a similar issue when trying ionic platform add android.

result; partial build with ENOENT error titled "cordova-plugin-console" on the same child process as mentioned above superspawn.js

After trying reinstalling etc.. without resolution I changed my path variables around. ANDROID_HOME was placed in user variables --

C:\Users\XXXXXX\AppData\Local\Android\android-sdk

PATH was updated in the system variables to remove previous entries for SDK and added at the end; %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Windows\System32;C:\Users\XXXXXX\Node\;C:\Users\XXXXX\AppData\Local\Android\android-sdk\tools;C:\Users\XXXXXX\AppData\Local\Android\android-sdk\platform-tools;

Restart pc, tested with new app ionic start <new folder> tabs cd to the folder created, test it runs with ionic serve --lab exit with q then try to add the platform. ionic platform add android

now it works..

Please note********* now when i run 'android' in the CMD from my user dir... C:\Users\XXXXX>android

i do not see the xcopy not found displayed to my screen. android SDK manager always loaded before and still now after i changed my paths.

Hope this helps p.s I run these cmds from my user acc which is not the admin acc as i never log in as or use my pc as an administrator.

Upvotes: 3

mattu
mattu

Reputation: 11

In my case problem was user variable TEMP. There were two folders.

Not working TEMP -path:

%USERPROFILE%\AppData\Local\Temp;C:\php

Working TEMP -path:

 %USERPROFILE%\AppData\Local\Temp

After this everything worked fine!

Upvotes: 1

Pranita Patil
Pranita Patil

Reputation: 821

In my case I just needed to add "C:\Windows\System32" to my windows path.

Upvotes: 3

Eymen Elkum
Eymen Elkum

Reputation: 3141

Try to follow these steps:

  1. run the command: npm uninstall cordova -g
  2. delete the folder: C:\Users\your-name\.cordova
  3. reinstall the cordova: npm install -g cordova
  4. now go to the project folder and try again: cordova platform add android

Upvotes: 1

Ana
Ana

Reputation: 11

Make sure that if you created PATH as a system variable, you should run Command Prompt as administrator.

I created PATH as a user variable, and would get the same error when tryin to run as administrator.

Upvotes: 1

ShinyJos
ShinyJos

Reputation: 1487

I had this exact same error days ago with cordova version 3.1.Go to directory path C:\Program Files\nodejs and then install your cordova.Sometimes cordova cannot connect to the right path of npm due to conflict.Then create your project and add platform android.Hope this solution works for you too.

Upvotes: 0

Related Questions