Why, Failed to fetch platform cordova-android.?

I started a new project but i get this amazing error

cordova platform add android --save
x Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android@~6.2.2
    Error: Failed to fetch platform cordova-android@~6.2.2
    Probably this is either a connection problem, or platform spec is
    Check your connection and platform name/version/URL.
    Error: cmd: Command failed with exit code 4294963248 Error output:
    npm ERR! path
    npm ERR! code EPERM
    npm ERR! errno -4048
    npm ERR! syscall unlink
    npm ERR! Error: EPERM: operation not permitted, unlink
    npm ERR!  { Error: EPERM: operation not permitted, unlink
    npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink
    npm ERR!   errno: -4048,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'unlink',
    npm ERR!   path:
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! A complete log of this run can be found in:
    npm ERR!

I tried to adding android@6.2.1 and android@6.1.2 both are same result. alo i tried cmd command by run as administrator, but it failed.

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: Uninstall your node, install nvm (or nvm-windows when you are using Windows), install a new node with this, then install ionic and cordova again and try your command again. The problem should be gone.


Dear @Sujan12 finally did Harakiri yesterday. I completely uninstalled Nodejs and removed installed packages then started again. my problem was solved but I will keep in mind your solution for next time.

In my case I have solved the problem downgrading npm from 5.4.1 to 4.6.1 this way:

sudo npm install npm@4.6.1 -g

This solved my issue too

1 Like

WOrked for mee too! Thanks very mch