npm 更新失败

npm ERR! Unexpected end of JSON input while parsing near 解决方法

1
2
3
4
5
6
7
   ╭─────────────────────────────────────╮
│ │
│ Update available 5.6.0 → 6.1.0 │
│ Run npm i npm to update │
│ │
╰─────────────────────────────────────╯
➜ github npm i npm to update

报错

1
2
3
4
npm ERR! Unexpected end of JSON input while parsing near '...","vinyl":"^1.1.1"},"'

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/niufeiy/.npm/_logs/2018-06-15T00_51_59_255Z-debug.log

解决方法

1
2
➜  npm cache clean --force
➜ github npm i npm to update