npm 安装vue脚手架报错

报错详情

npm ERR! Unexpected end of JSON input while parsing near '...TuHxXJaknDulF3AdSBoul'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2019-12-22T03_12_06_342Z-debug.log

最后解决方法

npm cache clean --force
npm i -g npm

不行再试一遍这些

npm ls --depth 0 -g // 看看哪些失效了
npm prune -g // 修剪下全局包
npm rebuild -g // 重建下全局包
npm update -g // 更新下全局包的版本
npm cache clear --force -g // 删除全局包的缓存(慎重)

对了重装是没有用得(我试过了)

再次安装

C:\Users\xxx>npm install vue-cli -g
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
C:\Users\xxx\AppData\Roaming\npm\vue -> C:\Users\xxx\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
C:\Users\xxx\AppData\Roaming\npm\vue-init -> C:\Users\xxx\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
C:\Users\xxx\AppData\Roaming\npm\vue-list -> C:\Users\xxx\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list
+ vue-cli@2.9.6
added 241 packages from 206 contributors in 170.007s

C:\Users\xxx>vue -V
2.9.6

C:\Users\xxx>

有点坑.....

希望能帮到同样问题得朋友

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2021-11-16
  • 2021-04-26
  • 2021-08-30
猜你喜欢
  • 2021-12-27
  • 2022-12-23
  • 2021-11-07
  • 2021-04-13
  • 2021-05-17
  • 2021-10-16
  • 2021-11-07
相关资源
相似解决方案