Mac 安装uirecorder 解决方法

安装uirecorder 时,依照http://uirecorder.com/ 说明
npm install uirecorder mocha -g
windows系统执行毫无压力,安装成功。
Mac 安装使用 sudo npm install uirecorder mocha -g 提示

ChromeDriver installation failed { Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/uirecorder/node_modules/chromedriver/lib/chromedriver'
    at Object.fs.mkdirSync (fs.js:891:18)
    at copyIntoPlace (/usr/local/lib/node_modules/uirecorder/node_modules/chromedriver/install.js:229:6)
    at Promise._successFn (/usr/local/lib/node_modules/uirecorder/node_modules/chromedriver/install.js:75:12)
    at nextTickCallback (/usr/local/lib/node_modules/uirecorder/node_modules/kew/kew.js:47:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/local/lib/node_modules/uirecorder/node_modules/chromedriver/lib/chromedriver' }

明明已经使用sudo 获取管理员权限,却提示没有创造文件夹的权限。猜测可能跟npm 安装的时候指向taobao源有关。
解决方案

  1. 安装cnpm 从淘宝服务器上下载 参考 http://npm.taobao.org/
    $ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

2.使用cnpm 安装
sudo cnpm install uirecorder -g

[[email protected]] scripts.preinstall: "node ./cyclic.js"
[[email protected]] link /usr/local/bin/uirecorder@ -> ../lib/node_modules/.uirecorder_npminstall/uirecorder/2.5.32/uirecorder/bin/uirecorder
[uirecorder@*] installed at node_modules/.uirecorder_npminstall/uirecorder/2.5.32/uirecorder (340 packages, use 5s, speed 1.86MB/s, json 671.68kB, tarball 9.14MB)
excute post install scripts...
[[email protected]] scripts.install: "(node-gyp rebuild 2> builderror.log) || (exit 0)" at /usr/local/lib/node_modules/.uirecorder_npminstall/websocket/1.0.22/websocket
[[email protected]] scripts.install success, use 615ms
[[email protected]] scripts.install: "node install.js" at /usr/local/lib/node_modules/.uirecorder_npminstall/chromedriver/2.32.3/chromedriver
Downloading http://tnpm-hz.oss-cn-hangzhou.aliyuncs.com/dist/chromedriver/2.32/chromedriver_mac64.zip
Saving to /tmp/chromedriver/chromedriver_mac64.zip
Received 785K...
Received 1566K...
Received 2347K...
Received 3131K...
Received 3920K...
Received 4702K...
Received 5084K total.
Extracting zip contents
Copying to target path /usr/local/lib/node_modules/.uirecorder_npminstall/chromedriver/2.32.3/chromedriver/lib/chromedriver
Fixing file permissions
Done. ChromeDriver binary available at /usr/local/lib/node_modules/.uirecorder_npminstall/chromedriver/2.32.3/chromedriver/lib/chromedriver/chromedriver
[[email protected]] scripts.install success, use 3s
All packages installed (340 packages installed from npm registry, use 9s, speed 1.13MB/s, json 418(671.68kB), tarball 9.14MB)

安装成功。 尽情享受开源带来的乐趣去吧。

你可能感兴趣的:(Mac 安装uirecorder 解决方法)