4

I tried to add android platform to my project but I got error:

~/learn/hello$ cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android/4.0.0
npm http 401 https://registry.npmjs.org/cordova-android/4.0.0
Unable to fetch platform android: Error: unauthorized Name or password is incorrect.: cordova-android/4.0.0

I'm wondering why this is happening Cordova version 5.0.0, Phonegap version 5.0.0-0.27.1

2 Answers 2

8

I think this issue because of .npmrc in your home directory, just remove it and everything should work

1
  • use "npm config ls -l | grep config" to list all configs, i just remove the user one.
    – A.T.
    Commented Aug 26, 2015 at 17:44
0

Most likely you have credentials in your .npmrc file that you need for publishing and cordova is misinterpreting them to be used.

Fix for this has been submitted: https://issues.apache.org/jira/browse/CB-8956 and won't show up until 5.1+ (Or whatever version number they decide to pick)

But in the meantime while Cordova 5.0.0 is latest, you can do this:

$HOME={current directory} cordova platform add android

Not the answer you're looking for? Browse other questions tagged or ask your own question.