今天安裝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