Cordova cannot add Android failed with exit code ENOENT

前端 未结 8 2272
日久生厌
日久生厌 2020-11-30 08:41

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

相关标签:
8条回答
  • 2020-11-30 08:45

    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.

    0 讨论(0)
  • 2020-11-30 08:45

    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
    0 讨论(0)
  • 2020-11-30 08:46

    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.

    0 讨论(0)
  • 2020-11-30 08:50

    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.

    0 讨论(0)
  • 2020-11-30 08:52

    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!

    0 讨论(0)
  • 2020-11-30 08:55

    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.

    0 讨论(0)
提交回复
热议问题