Solvednativescript cli Error: Exception: The plugin tns-android@2.5.0 is already installed

Just updated to 2.5. I can add the ios platform and run on the emulator, but I can't add the android platform (OS X 10.12.2).

UPDATE: when I create a new test project, tns run android works. But I still can't add the android platform to my existing project. Pointers appreciated.

van-aimc-l2dnmp:aapa-conference-app hagen$ node --version
v7.5.0
van-aimc-l2dnmp:aapa-conference-app hagen$ npm --version
4.1.2
van-aimc-l2dnmp:aapa-conference-app hagen$ tns --version
2.5.0
van-aimc-l2dnmp:aapa-conference-app hagen$ tns doctor
Verifying CocoaPods. This may take more than a minute, please be patient.
   Installing iOS runtime.nativescript-check-cocoapods@0.0.1 /private/var/folders/6p/vb6bmpxd65v_hpd91kzj3jhh0000gq/T/nativescript-check-cocoapods11713-24129-lbxqsa.djp4vrhpvi
└── tns-ios@2.5.0 


   Verifying CocoaPods. This may take some time, please be patient..
Your components are up-to-date.

No issues were detected.
van-aimc-l2dnmp:aapa-conference-app hagen$ npm uninstall tns-android
- tns-android@2.5.0 node_modules/tns-android
van-aimc-l2dnmp:aapa-conference-app hagen$ npm cache clean
van-aimc-l2dnmp:aapa-conference-app hagen$ tns platform add android --log trace
execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
spawn: /usr/local/opt/android-sdk/platform-tools/adb "--help"
Socket {
  connecting: false,
  _hadError: false,
  _handle: 
   Pipe {
     bytesRead: 0,
     _externalStream: {},
     fd: 15,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: 
   { end: { [Function: bound onceWrapper] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function: bound onwrite],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: 
      CorkedRequest {
        next: null,
        entry: null,
        finish: [Function: bound onCorkedFinish] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  _bytesDispatched: 0,
  _sockname: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec uname -a 
 stdout: Darwin van-aimc-l2dnmp.vancouver.wsu.edu 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
 
 stderr: 
Exec npm -v 
 stdout: 4.1.2
 
 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 8.1
Build version 8B62
 
 stderr: 
Exec gem which xcodeproj 
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb
 
 stderr: 
Exec pod --version 
 stdout: 1.2.0
 
 stderr: 
Exec '/usr/local/opt/android-sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.36
Revision 0e9850346394-android
 
 stderr: 
spawn: /usr/local/opt/android-sdk/tools/android "-h"
Result when throw error is false:
{ stdout: '\n       Usage:\n       android [global options] action [action options]\n       Global options:\n  -s --silent     : Silent mode, shows errors only.\n  -v --verbose    : Verbose mode, shows errors, warnings and all messages.\n     --clear-cache: Clear the SDK Manager repository manifest cache.\n  -h --help       : Help on a specific command.\n\n                                                                    Valid\n                                                                    actions\n                                                                    are\n                                                                    composed\n                                                                    of a verb\n                                                                    and an\n                                                                    optional\n                                                                    direct\n                                                                    object:\n-    sdk              : Displays the SDK Manager window.\n-    avd              : Displays the AVD Manager window.\n-   list              : Lists existing targets or virtual devices.\n-   list avd          : Lists existing Android Virtual Devices.\n-   list target       : Lists existing targets.\n-   list device       : Lists existing devices.\n-   list sdk          : Lists remote SDK repository.\n- create avd          : Creates a new Android Virtual Device.\n-   move avd          : Moves or renames an Android Virtual Device.\n- delete avd          : Deletes an Android Virtual Device.\n- update avd          : Updates an Android Virtual Device to match the folders\n                        of a new SDK.\n- create project      : Creates a new Android project.\n- update project      : Updates an Android project (must already have an\n                        AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n                        already have an AndroidManifest.xml).\n- create lib-project  : Creates a new Android library project.\n- update lib-project  : Updates an Android library project (must already have\n                        an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb          : Updates adb to support the USB devices declared in the\n                        SDK add-ons.\n- update sdk          : Updates the SDK by suggesting new platforms to install\n                        if available.\n',
  stderr: '',
  exitCode: 1 }
Exec mono --version 
 stdout:  
 stderr: /bin/sh: mono: command not found

Exec git --version 
 stdout: git version 2.9.3 (Apple Git-75)
 
 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javac" -version 
 stdout:  
 stderr: javac 1.8.0_101

System information:
{ procInfo: 'nativescript/2.5.0',
  platform: 'darwin',
  os: 'Darwin van-aimc-l2dnmp.vancouver.wsu.edu 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v7.5.0',
  npmVer: '4.1.2',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.1\nBuild version 8B62\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.2.0',
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: null,
  gitVer: '2.9.3 (Apple Git-75)',
  gradleVer: null,
  javacVersion: '1.8.0_101' }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'platform'.
Looking for project in '/Users/hagen/Documents/Websites/AAPA/aapa-conference-app'
Project directory is '/Users/hagen/Documents/Websites/AAPA/aapa-conference-app'.
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'platform|add'.
Creating NativeScript project for the android platform
Path: /Users/hagen/Documents/Websites/AAPA/aapa-conference-app/platforms/android
Package: org.nativescript.aapaconferenceapp
Name: aapaconferenceapp
Copying template files...
   Installing tns-androidExec npm view tns-android --json  dist-tags 
 stdout: {
  "latest": "2.5.0",
  "next": "2.6.0-next-2017-02-01-1648"
}
 
 stderr: 
Using version 2.5.0. 
Installing  tns-android
spawn: npm "install" "tns-android@2.5.0" "--silent" "--save"
   Installing tns-android/Users/hagen/Documents/Websites/AAPA/aapa-conference-app
└── tns-android@2.5.0 


The plugin tns-android@2.5.0 is already installed
{ Error: The plugin tns-android@2.5.0 is already installed
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:107:28)
    at Errors.failWithoutHelp (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:115:14)
    at /usr/local/lib/node_modules/nativescript/lib/node-package-manager.js:63:30
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:111:75
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:92:106
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
  name: 'Exception',
  message: 'The plugin tns-android@2.5.0 is already installed',
  stack: 'Error: The plugin tns-android@2.5.0 is already installed\n    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:107:28)\n    at Errors.failWithoutHelp (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:115:14)\n    at /usr/local/lib/node_modules/nativescript/lib/node-package-manager.js:63:30\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)\n    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)\n    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:111:75\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)\n    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)\n    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:92:106\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)',
  errorCode: 127,
  suppressCommandHelp: true,
  futureStack: 'Error: The plugin tns-android@2.5.0 is already installed\n    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:107:28)\n    at Errors.failWithoutHelp (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:115:14)\n    at /usr/local/lib/node_modules/nativescript/lib/node-package-manager.js:63:30\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)\n    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)\n    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:111:75\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)\n    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)\n    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:92:106\n    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)' }
%s. Error: %s
Error: Failed to retrieve data from npm. Please try again a little bit later.. Error: Exception: The plugin tns-android@2.5.0 is already installed
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:107:28)
    at /usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:47:30
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:85:142
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at _.each.platform (/usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:53:58)
    at arrayEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:451:11)
    at Function.forEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:8634:14)
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'help'.
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|*list, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, post-install-cli, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'platform|add'. FileName is 'platform-add.md'.
# platform add

┌──────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
 Usage                     Synopsis                                                                                                                                        
 Android latest runtime    $ tns platform add android [--framework-path <File Path>] [--symlink] [--sdk <API Level>] [--platform-template <Platform Template>]             
 Android selected runtime  $ tns platform add android[@<Version>] [--framework-path <File Path>] [--symlink] [--sdk <API Level>] [--platform-template <Platform Template>] 
 iOS latest runtime        $ tns platform add ios [--framework-path <File Path>] [--symlink]                                                                               
 iOS selected runtime      $ tns platform add ios[@<Version>] [--framework-path <File Path>] [--symlink] [--platform-template <Platform Template>]                         
└──────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Configures the current project to target the selected platform. 

### Options

    * --framework-path - Sets the path to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If --symlink is specified, <File Path> must point to directory in which the runtime is already extracted. If --symlink is not specified, <File Path> must point to a valid npm package.
    * --symlink - Creates a symlink to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If --frameworkPath is specified, creates a symlink to the specified directory. If --frameworkPath is not specified, creates a symlink to platform runtime installed with your current version of NativeScript.
    * --sdk - Sets the target Android SDK for the project.
    * --platform-template - Sets the platform template that will be used for the native application.

### Attributes

    * <API Level> is a valid Android API level. For example: 17, 19, MNC.
    * <File Path> is the complete path to a valid npm package or a directory that contains a NativeScript runtime for the selected platform.
    * <Platform Template> is a valid npm package, path to directory, .tgz or GitHub URL that contains a native Android or iOS template.
    * <Version> is any available version of the respective platform runtime published in npm. 

Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track exception with message 'Failed to retrieve data from npm. Please try again a little bit later.. Error: Exception: The plugin tns-android@2.5.0 is already installed'.
43 Answers

✔️Accepted Answer

It is a known issue that occurs sometimes, and is a bit annoying.

To fix it you need to edit your package.json's content and remove the tns-android dependency under "dependencies: { }", as well as the android entry from the "nativescript: { }" key if one was also written there. Then clear the npm cache npm cache clear and proceed with installing the platform again - tns platform add android

More Issues: