安装appium时一直报下面的错,使用sudo安装appium能够安装,但运行不起来。
  请大神指点一下,如何挽救....
  解决方法:
  1、卸载appium 和nodejs(dmg安装无需卸载)
  2、sudo chmod -R 777 /usr/local (不知道是否一定要到这个目录,或许只需要修改到lib目录可以了)
  3、重新安装 appium

localhost:temp test2$ npm install -g appium
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/appium'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/appium']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/appium',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/appium',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "appium"
npm ERR! cwd /Users/test2/temp
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/appium
npm ERR! fstream_path /usr/local/lib/node_modules/appium
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/appium'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/test2/temp/npm-debug.log
npm ERR! not ok code 0
localhost:temp test2$
  使用sudo安装的appium,执行的时候报错
ocalhost:temp test2$ appium
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using sudo npm install -g appium, the solution is to reinstall Node using a method (Homebrew, for example) that doesn't require sudo to install global npm packages.
localhost:temp test2$ sudo appium
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using sudo npm install -g appium, the solution is to reinstall Node using a method (Homebrew, for example) that doesn't require sudo to install global npm packages.