如题,我的安装是正常的,node、nam、appium 的安装都是正常的,也能正常查看版本号

SvenWengdeMBP:~ svenweng$ node -v
v0.10.34
SvenWengdeMBP:~ svenweng$ npm -v
1.4.28
SvenWengdeMBP:~ svenweng$ appium -v
1.4.16

执行 appium-doctor 显示的也是正确的

SvenWengdeMBP:~ svenweng$ appium-doctor
Running iOS Checks
✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
✔ Xcode Command Line Tools are installed.
✔ DevToolsSecurity is enabled.
✔ The Authorization DB is set up properly.
✔ Node binary found at /usr/local/bin/node
✔ iOS Checks were successful.

Running Android Checks
✔ ANDROID_HOME is set to "/Users/svenweng/Desktop/Application/adt-bundle-mac-x86_64-20131030/sdk"
✔ JAVA_HOME is set to "/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home."
✔ ADB exists at /Users/svenweng/Desktop/Application/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb
✔ Android exists at /Users/svenweng/Desktop/Application/adt-bundle-mac-x86_64-20131030/sdk/tools/android
✔ Emulator exists at /Users/svenweng/Desktop/Application/adt-bundle-mac-x86_64-20131030/sdk/tools/emulator
✔ Android Checks were successful.

✔ All Checks were successful

但是我执行 appium 的时候就报了好多好多的错误,跪求大神给科普一下到底是啥原因啊!
*** 工具正常了,我进入了命令行提示的错误网址
网址上显示的是这个
Error: fn must be a function

This page is here for the sake of completeness. There really is nothing much to add on that error.
翻译过来就是:
错误: FN 必须是一个函数

这页是这里为了完整性。真的是没有什么补充该错误。


折腾了一天,终于把问题搞定了,问题的原因是因为 node 的版本太旧了导致的,原因分析在1 楼回答的那个链接上,再说说今天自己折腾过程中遇到的问题吧,我在网上搜索帖子的时候说需要吧 node 卸载了才能升级(我真是天真)。于是按照步骤手贱删除了一些不应该删除的东西,结果搞的很乱,思路都乱了,不知道从何下手。于是我就去睡了一觉,醒来重新折腾,重新去官网下了一个 node 的安装包,把之前干掉的 node 环境重新部署好。再使用 npm install -g appium 的时候,一直会出现这个问题

SvenWengdeMBP:~ svenweng$ npm install -g appium
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-10484-941ff227/registry.npmjs.org/appium-uiauto/-/appium-uiauto-1.10.10.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-10484-941ff227/registry.npmjs.org/appium-instruments/-/appium-instruments-2.0.6.tgz
loadRequestedDeps → netwo ▐ ╢███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
C
SvenWengdeMBP:~ svenweng$ sudo chmod -r 777 /usr/local
Password:
chmod: 777: No such file or directory
SvenWengdeMBP:~ svenweng$ sudo chmod -R 777 /usr/local
SvenWengdeMBP:~ svenweng$ npm install -g appium
loadRequestedDeps → netwo ▄ ╢███████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
C
SvenWengdeMBP:~ svenweng$ npm install -g appium
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/hoek/-/hoek-2.16.3.tgz
npm ERR! tar.unpack untar error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/hoek/-/hoek-2.16.3.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.8.tgz
npm ERR! tar.unpack untar error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.8.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/core-js/-/core-js-0.9.18.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/appium-adb/-/appium-adb-1.7.5.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/appium-instruments/-/appium-instruments-2.0.6.tgz
npm ERR! tar.unpack unzip error /var/folders/hm/04tcnt812v909nysd8jgl0100000gn/T/npm-13599-e762bf07/registry.npmjs.org/appium-uiauto/-/appium-uiauto-1.10.10.tgz
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "appium"
npm ERR! node v5.1.0
npm ERR! npm v3.3.12
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5

npm ERR! unexpected end of file
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

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

每次安装到一半都安装不下去,我的电脑也是 *** 的,按道理应该也都能下载才对,具体详细的原因请恕我是小白,不太懂这个。不过我换了一个下载源就把这个问题搞定了,这里发出来,希望下次有遇到这种问题的朋友不会在这个地方浪费太多时间。命令是这个:npm -g --registry http://registry.cnpmjs.org install appium

前前后后折腾了差不多一周的环境,终于把环境的问题搞定了,希望能够更深入的学习,也给自己一个勉励。


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