Error from "npm install -g appium" - appium.js symlink target is not controlled by npm /usr/local

I am trying to upgrade Appium today and am unable to do so via “npm install -g appium” due to the following error. Could someone please help ?

$ npm install -g appium

/usr/local/bin/authorize-ios -> /usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios
└── (empty)

npm ERR! Darwin 15.5.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “-g” “appium”
npm ERR! node v4.4.4
npm ERR! npm v3.9.0
npm ERR! path /usr/local/bin/appium
npm ERR! code EEXIST

npm ERR! Refusing to delete /usr/local/bin/appium: …/lib/node_modules/appium/bin/appium.js symlink target is not controlled by npm /usr/local
npm ERR! File exists: /usr/local/bin/appium
npm ERR! Move it away, and try again.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/mayukataoka/npm-debug.log
npm ERR! code 1

$ ls -lah /usr/local/bin/appium
lrwxr-xr-x 1 mayukataoka admin 40B May 29 2015 /usr/local/bin/appium -> …/lib/node_modules/appium/bin/appium.js

Fixed by removing /usr/local/bin/appium and resinstalling it.

Thanks Mayu for your post – I had the same problem. I did a node uninstall and reinstall of appium but still saw the problem. When I removed the appium bin from my .linuxbrew/bin directory manually, the installation succeeded.

Appium on Linux is not quite as smooth as osx, but looks like it’s working now. Thanks for your post!