以前安装的 Appium 不小心手误给删掉了,重新装了以后启动 appium 总是报错:

-bash: appium: command not found

安装的步骤如下:

cnpm install -g appium

其他依赖都已经安装好了,但是启动 appium 的时候提示

-bash: appium: command not found

我是安装在默认路径下的,以前搭环境按照指导贴一步一步进行挺顺利的。。。不知道重新安装为什么会这样,请各位帮忙看看吧谢谢了
LOG 如下

yefengjundeMacBook-Pro:node_modules yefengjun$ cnpm install -g appium
Downloading appium to /usr/local/lib/node_modules/appium_tmp
Copying /usr/local/lib/node_modules/appium_tmp/.1.6.4@appium to /usr/local/lib/node_modules/appium
Installing appium's dependencies to /usr/local/lib/node_modules/appium/node_modules
JSONResponseFormatError: [appium-support@2.8.2 › archiver@1.3.0 › zip-stream@1.1.1 › compress-commons@^1.1.0] Unexpected end of JSON input (data json format: "{\"name\":\"compress-commons\",\"version\":\"1.2.0\",\"description\":\"a library that defines a common interface for working with archive formats within node\",\"homepage\":\"https://github.com/archiverjs/node-compress-commons\",\"author\":{\"name\":\"Chris Talkington\",\"url\":\"http://christalkington.com/\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/archiverjs/node-compress-commons.git\"},\"bugs\":{\"url\":\"https://github.com/archiverjs/node-compress-commons/issues\"},\"license\":\"MIT\",\"main\":\"lib/compress-commons.js\",\"file" ...skip... ",\"normalize-path\":\"^2.0.0\",\"readable-stream\":\"^2.0.0\"},\"devDependencies\":{\"chai\":\"^3.4.0\",\"mocha\":\"^3.2.0\",\"rimraf\":\"^2.4.3\",\"mkdirp\":\"^0.5.0\"},\"keywords\":[\"compress\",\"commons\",\"archive\"],\"publishConfig\":{\"registry\":\"https://registry.npmjs.org/\"},\"gitHead\":\"259d1a1785b14fde269ec0f87168172bffee511e\",\"_id\":\"compress-commons@1.2.0\",\"_shasum\":\"58587092ef20d37cb58baf000112c9278ff73b9f\",\"_from\":\".\",\"_npmVersion\":\"3.10.10\",\"_nodeVersion\":\"6.10.0\",\"_npmUser\":{\"name\":\"ctalkington\",\"email\":\"chris@talkingtontech.com\"}"), GET https://registry.npm.taobao.org/compress-commons/%3E%3D1.1.0%20%3C2.0.0 200 (connected: true, keepalive socket: true, agent status: {"createSocketCount":23,"closeSocketCount":4,"errorSocketCount":0,"timeoutSocketCount":2,"requestCount":776,"freeSockets":{"registry.npm.taobao.org:443:::::::true:":5},"sockets":{"cdn.npm.taobao.org:443:::::::true:":10,"registry.npm.taobao.org:443:::::::true:":4},"requests":{"cdn.npm.taobao.org:443:::::::true:":41}})
headers: {"date":"Tue, 23 May 2017 11:57:54 GMT","content-type":"application/json; charset=utf-8","content-length":"1716","connection":"keep-alive","x-current-requests":"1","etag":"\"6b4-u+ly8Rfj+Qfwbg+tLc0B+lpRd44\"","x-readtime":"12"}
    at Object.parse (native)
    at parseJSON (/usr/local/lib/node_modules/cnpm/node_modules/urllib/lib/urllib.js:874:24)
    at /usr/local/lib/node_modules/cnpm/node_modules/urllib/lib/urllib.js:657:23
    at decodeContent (/usr/local/lib/node_modules/cnpm/node_modules/urllib/lib/urllib.js:511:14)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cnpm/node_modules/urllib/lib/urllib.js:638:7)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
npminstall version: 2.13.3
npminstall args: /usr/local/bin/node /usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --china --userconfig=/Users/yefengjun/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org -g appium
yefengjundeMacBook-Pro:node_modules yefengjun$ appium
-bash: appium: command not found


↙↙↙阅读原文可查看相关链接,并与作者交流