今天安装cnpm失败,报这个错误:
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm ERR! Unexpected end of JSON input while parsing near '..."},"directories":{},"'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-06-09T11_41_55_356Z-debug.log
解决办法:
npm set registry https://registry.npm.taobao.org // 注册模块镜像
npm set disturl https://npm.taobao.org/dist // node-gyp 编译依赖的 node 源码镜像
npm cache clean --force // 清空缓存
npm install -g cnpm --registry=https://registry.npm.taobao.org