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 [email protected]: This package has been deprecated in favour of @vue/cli
npm WARN deprecated [email protected]: 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
+ [email protected]
added 241 packages from 206 contributors in 170.007s
C:\Users\xxx>vue -V
2.9.6
C:\Users\xxx>
有点坑.....
希望能帮到同样问题得朋友
原文地址:https://www.cnblogs.com/duoban/p/12079541.html
时间: 2024-10-07 18:26:45