问题表现
➜ npm install --registry=https://registry.npm.taobao.org
npm ERR! code 128
npm ERR! Command failed: git clone --depth=1 -q -b fix/ie-cannot-input-korean git://github.com/sohee-lee7/Squire.git /Users/jaron/.npm/_cacache/tmp/git-clone-3287fdd8
问题分析
比较明显,git clone失败了;原因应该是创建文件失败;
查看权限:
➜ ll /Users/jaron/.npm/_cacache
total 0
drwxr-xr-x 5 jaron staff 160 1 17 2019 .
drwxr-xr-x 9 jaron staff 288 7 13 08:11 ..
drwxr-xr-x 4 root staff 128 1 17 2019 content-v2
drwxr-xr-x 258 root staff 8256 3 15 2019 index-v5
drwxr-xr-x 2 root staff 64 12 5 19:41 tmp
解决方法
# 这里jaron是我的用户名,实际情况请各自修改
➜ sudo chown -R jaron /Users/jaron/.npm